Merge branch 'NetHack-3.7'

This commit is contained in:
nhmall
2018-12-25 22:15:02 -05:00
60 changed files with 741 additions and 692 deletions
+2 -2
View File
@@ -43,7 +43,7 @@ struct attribs {
#define ATTRMAX(x) \ #define ATTRMAX(x) \
((x == A_STR && Upolyd && strongmonst(g.youmonst.data)) \ ((x == A_STR && Upolyd && strongmonst(g.youmonst.data)) \
? STR18(100) \ ? STR18(100) \
: urace.attrmax[x]) : g.urace.attrmax[x])
#define ATTRMIN(x) (urace.attrmin[x]) #define ATTRMIN(x) (g.urace.attrmin[x])
#endif /* ATTRIB_H */ #endif /* ATTRIB_H */
+58
View File
@@ -592,7 +592,21 @@ struct repo { /* repossession context */
coord location; coord location;
}; };
/* from options.c */
#define MAX_MENU_MAPPED_CMDS 32 /* some number */
/* player selection constants */
#define BP_ALIGN 0
#define BP_GEND 1
#define BP_RACE 2
#define BP_ROLE 3
#define NUM_BP 4
#define NUM_ROLES (13)
struct role_filter {
boolean roles[NUM_ROLES+1];
short mask;
};
/* 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
@@ -924,6 +938,11 @@ struct instance_globals {
short *animal_list; /* list of PM values for animal monsters */ short *animal_list; /* list of PM values for animal monsters */
int animal_list_count; int animal_list_count;
/* mthrowu.c */
int mesg_given; /* for m_throw()/thitu() 'miss' message */
struct monst *mtarget; /* monster being shot by another monster */
struct monst *marcher; /* monster that is shooting */
/* 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;
@@ -936,6 +955,12 @@ struct instance_globals {
* remember who zapped the wand. */ * remember who zapped the wand. */
struct musable m; struct musable m;
/* nhlan.c */
#ifdef MAX_LAN_USERNAME
char lusername[MAX_LAN_USERNAME];
int lusername_size;
#endif
/* o_init.c */ /* o_init.c */
short disco[NUM_OBJECTS]; short disco[NUM_OBJECTS];
@@ -949,6 +974,16 @@ struct instance_globals {
/* options.c */ /* options.c */
struct symsetentry *symset_list; /* files.c will populate this with struct symsetentry *symset_list; /* files.c will populate this with
list of available sets */ list of available sets */
/*
* Allow the user to map incoming characters to various menu commands.
* The accelerator list must be a valid C string.
*/
char mapped_menu_cmds[MAX_MENU_MAPPED_CMDS + 1]; /* exported */
char mapped_menu_op[MAX_MENU_MAPPED_CMDS + 1];
short n_menu_mapped;
boolean opt_initial;
boolean opt_from_file;
boolean opt_need_redraw; /* for doset() */
/* pickup.c */ /* pickup.c */
int oldcap; /* last encumberance */ int oldcap; /* last encumberance */
@@ -1006,6 +1041,11 @@ struct instance_globals {
/* read.c */ /* read.c */
boolean known; boolean known;
/* region.c */
NhRegion **regions;
int n_regions;
int max_regions;
/* restore.c */ /* restore.c */
int n_ids_mapped; int n_ids_mapped;
struct bucket *id_map; struct bucket *id_map;
@@ -1013,6 +1053,16 @@ struct instance_globals {
struct fruit *oldfruit; struct fruit *oldfruit;
long omoves; long omoves;
/* rip.c */
char **rip;
/* role.c */
struct Role urole; /* player's role. May be munged in role_init() */
struct Race urace; /* player's race. May be munged in role_init() */
char role_pa[NUM_BP];
char role_post_attribs;
struct role_filter rfilter;
/* rumors.c */ /* rumors.c */
long true_rumor_size; /* rumor size variables are signed so that value -1 long true_rumor_size; /* rumor size variables are signed so that value -1
can be used as a flag */ can be used as a flag */
@@ -1040,6 +1090,8 @@ struct instance_globals {
shouldn't carry over from ordinary selling to credit selling */ shouldn't carry over from ordinary selling to credit selling */
boolean auto_credit; boolean auto_credit;
struct repo repo; struct repo repo;
long int followmsg; /* last time of follow message */
/* sp_lev.c */ /* sp_lev.c */
char *lev_message; char *lev_message;
@@ -1062,6 +1114,9 @@ struct instance_globals {
int spl_sortmode; /* index into spl_sortchoices[] */ int spl_sortmode; /* index into spl_sortchoices[] */
int *spl_orderindx; /* array of g.spl_book[] indices */ int *spl_orderindx; /* array of g.spl_book[] indices */
/* teleport.c */
struct obj *telescroll; /* non-null when teleporting via this scroll */
/* timeout.c */ /* timeout.c */
/* ordered timer list */ /* ordered timer list */
struct fe *timer_base; /* "active" */ struct fe *timer_base; /* "active" */
@@ -1069,6 +1124,9 @@ struct instance_globals {
/* topten.c */ /* topten.c */
winid toptenwin; winid toptenwin;
#ifdef UPDATE_RECORD_IN_PLACE
long final_fpos;
#endif
/* trap.c */ /* trap.c */
+3 -3
View File
@@ -332,9 +332,9 @@
#define hero_glyph \ #define hero_glyph \
monnum_to_glyph((Upolyd || !flags.showrace) \ monnum_to_glyph((Upolyd || !flags.showrace) \
? u.umonnum \ ? u.umonnum \
: (flags.female && urace.femalenum != NON_PM) \ : (flags.female && g.urace.femalenum != NON_PM) \
? urace.femalenum \ ? g.urace.femalenum \
: urace.malenum) : g.urace.malenum)
/* /*
* Change the given glyph into it's given type. Note: * Change the given glyph into it's given type. Note:
+1
View File
@@ -27,6 +27,7 @@ E void NDECL(newgame);
E void FDECL(welcome, (BOOLEAN_P)); E void FDECL(welcome, (BOOLEAN_P));
E time_t NDECL(get_realtime); E time_t NDECL(get_realtime);
E int FDECL(argcheck, (int, char **, enum earlyarg)); E int FDECL(argcheck, (int, char **, enum earlyarg));
E void NDECL(early_init);
/* ### apply.c ### */ /* ### apply.c ### */
+2 -2
View File
@@ -211,6 +211,8 @@ typedef struct {
#define SYM_OFF_X (SYM_OFF_W + WARNCOUNT) #define SYM_OFF_X (SYM_OFF_W + WARNCOUNT)
#define SYM_MAX (SYM_OFF_X + MAXOTHER) #define SYM_MAX (SYM_OFF_X + MAXOTHER)
#include "rect.h"
#include "region.h"
#include "decl.h" #include "decl.h"
#include "timeout.h" #include "timeout.h"
@@ -258,8 +260,6 @@ typedef struct sortloot_item Loot;
#include "vision.h" #include "vision.h"
#include "display.h" #include "display.h"
#include "engrave.h" #include "engrave.h"
#include "rect.h"
#include "region.h"
#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
+3 -3
View File
@@ -84,7 +84,7 @@
#define is_gnome(ptr) (((ptr)->mflags2 & M2_GNOME) != 0L) #define is_gnome(ptr) (((ptr)->mflags2 & M2_GNOME) != 0L)
#define is_orc(ptr) (((ptr)->mflags2 & M2_ORC) != 0L) #define is_orc(ptr) (((ptr)->mflags2 & M2_ORC) != 0L)
#define is_human(ptr) (((ptr)->mflags2 & M2_HUMAN) != 0L) #define is_human(ptr) (((ptr)->mflags2 & M2_HUMAN) != 0L)
#define your_race(ptr) (((ptr)->mflags2 & urace.selfmask) != 0L) #define your_race(ptr) (((ptr)->mflags2 & g.urace.selfmask) != 0L)
#define is_bat(ptr) \ #define is_bat(ptr) \
((ptr) == &mons[PM_BAT] || (ptr) == &mons[PM_GIANT_BAT] \ ((ptr) == &mons[PM_BAT] || (ptr) == &mons[PM_GIANT_BAT] \
|| (ptr) == &mons[PM_VAMPIRE_BAT]) || (ptr) == &mons[PM_VAMPIRE_BAT])
@@ -100,8 +100,8 @@
#define is_wanderer(ptr) (((ptr)->mflags2 & M2_WANDER) != 0L) #define is_wanderer(ptr) (((ptr)->mflags2 & M2_WANDER) != 0L)
#define always_hostile(ptr) (((ptr)->mflags2 & M2_HOSTILE) != 0L) #define always_hostile(ptr) (((ptr)->mflags2 & M2_HOSTILE) != 0L)
#define always_peaceful(ptr) (((ptr)->mflags2 & M2_PEACEFUL) != 0L) #define always_peaceful(ptr) (((ptr)->mflags2 & M2_PEACEFUL) != 0L)
#define race_hostile(ptr) (((ptr)->mflags2 & urace.hatemask) != 0L) #define race_hostile(ptr) (((ptr)->mflags2 & g.urace.hatemask) != 0L)
#define race_peaceful(ptr) (((ptr)->mflags2 & urace.lovemask) != 0L) #define race_peaceful(ptr) (((ptr)->mflags2 & g.urace.lovemask) != 0L)
#define extra_nasty(ptr) (((ptr)->mflags2 & M2_NASTY) != 0L) #define extra_nasty(ptr) (((ptr)->mflags2 & M2_NASTY) != 0L)
#define strongmonst(ptr) (((ptr)->mflags2 & M2_STRONG) != 0L) #define strongmonst(ptr) (((ptr)->mflags2 & M2_STRONG) != 0L)
#define can_breathe(ptr) attacktype(ptr, AT_BREA) #define can_breathe(ptr) attacktype(ptr, AT_BREA)
+6 -8
View File
@@ -23,8 +23,8 @@ struct RoleName {
struct RoleAdvance { struct RoleAdvance {
/* "fix" is the fixed amount, "rnd" is the random amount */ /* "fix" is the fixed amount, "rnd" is the random amount */
xchar infix, inrnd; /* at character initialization */ xchar infix, inrnd; /* at character initialization */
xchar lofix, lornd; /* gained per level < urole.xlev */ xchar lofix, lornd; /* gained per level < g.urole.xlev */
xchar hifix, hirnd; /* gained per level >= urole.xlev */ xchar hifix, hirnd; /* gained per level >= g.urole.xlev */
}; };
struct u_have { struct u_have {
@@ -167,9 +167,8 @@ struct Role {
}; };
extern const struct Role roles[]; /* table of available roles */ extern const struct Role roles[]; /* table of available roles */
extern struct Role urole; #define Role_if(X) (g.urole.malenum == (X))
#define Role_if(X) (urole.malenum == (X)) #define Role_switch (g.urole.malenum)
#define Role_switch (urole.malenum)
/* used during initialization for race, gender, and alignment /* used during initialization for race, gender, and alignment
as well as for character class */ as well as for character class */
@@ -219,9 +218,8 @@ struct Race {
}; };
extern const struct Race races[]; /* Table of available races */ extern const struct Race races[]; /* Table of available races */
extern struct Race urace; #define Race_if(X) (g.urace.malenum == (X))
#define Race_if(X) (urace.malenum == (X)) #define Race_switch (g.urace.malenum)
#define Race_switch (urace.malenum)
/*** Unified structure specifying gender information ***/ /*** Unified structure specifying gender information ***/
struct Gender { struct Gender {
+13 -4
View File
@@ -19,6 +19,15 @@ STATIC_DCL void FDECL(regen_hp, (int));
STATIC_DCL void FDECL(interrupt_multi, (const char *)); STATIC_DCL void FDECL(interrupt_multi, (const char *));
STATIC_DCL void FDECL(debug_fields, (const char *)); STATIC_DCL void FDECL(debug_fields, (const char *));
void
early_init()
{
decl_globals_init();
objects_globals_init();
monst_globals_init();
sys_early_init();
}
void void
moveloop(resuming) moveloop(resuming)
boolean resuming; boolean resuming;
@@ -656,16 +665,16 @@ boolean new_game; /* false => restoring an old game */
*buf = '\0'; *buf = '\0';
if (new_game || u.ualignbase[A_ORIGINAL] != u.ualignbase[A_CURRENT]) if (new_game || u.ualignbase[A_ORIGINAL] != u.ualignbase[A_CURRENT])
Sprintf(eos(buf), " %s", align_str(u.ualignbase[A_ORIGINAL])); Sprintf(eos(buf), " %s", align_str(u.ualignbase[A_ORIGINAL]));
if (!urole.name.f if (!g.urole.name.f
&& (new_game && (new_game
? (urole.allow & ROLE_GENDMASK) == (ROLE_MALE | ROLE_FEMALE) ? (g.urole.allow & ROLE_GENDMASK) == (ROLE_MALE | ROLE_FEMALE)
: currentgend != flags.initgend)) : currentgend != flags.initgend))
Sprintf(eos(buf), " %s", genders[currentgend].adj); Sprintf(eos(buf), " %s", genders[currentgend].adj);
pline(new_game ? "%s %s, welcome to NetHack! You are a%s %s %s." pline(new_game ? "%s %s, welcome to NetHack! You are a%s %s %s."
: "%s %s, the%s %s %s, welcome back to NetHack!", : "%s %s, the%s %s %s, welcome back to NetHack!",
Hello((struct monst *) 0), g.plname, buf, urace.adj, Hello((struct monst *) 0), g.plname, buf, g.urace.adj,
(currentgend && urole.name.f) ? urole.name.f : urole.name.m); (currentgend && g.urole.name.f) ? g.urole.name.f : g.urole.name.m);
} }
#ifdef POSITIONBAR #ifdef POSITIONBAR
+4 -4
View File
@@ -59,9 +59,9 @@ hack_artifacts()
artilist[ART_EXCALIBUR].role = NON_PM; artilist[ART_EXCALIBUR].role = NON_PM;
/* Fix up the quest artifact */ /* Fix up the quest artifact */
if (urole.questarti) { if (g.urole.questarti) {
artilist[urole.questarti].alignment = alignmnt; artilist[g.urole.questarti].alignment = alignmnt;
artilist[urole.questarti].role = Role_switch; artilist[g.urole.questarti].role = Role_switch;
} }
return; return;
} }
@@ -763,7 +763,7 @@ struct monst *mtmp;
} else if (weap->spfx & SPFX_DFLAG2) { } else if (weap->spfx & SPFX_DFLAG2) {
return ((ptr->mflags2 & weap->mtype) return ((ptr->mflags2 & weap->mtype)
|| (yours || (yours
&& ((!Upolyd && (urace.selfmask & weap->mtype)) && ((!Upolyd && (g.urace.selfmask & weap->mtype))
|| ((weap->mtype & M2_WERE) && u.ulycn >= LOW_PM)))); || ((weap->mtype & M2_WERE) && u.ulycn >= LOW_PM))));
} else if (weap->spfx & SPFX_DALIGN) { } else if (weap->spfx & SPFX_DALIGN) {
return yours ? (u.ualign.type != weap->alignment) return yours ? (u.ualign.type != weap->alignment)
+21 -21
View File
@@ -599,15 +599,15 @@ register int np;
register int i, x, tryct; register int i, x, tryct;
for (i = 0; i < A_MAX; i++) { for (i = 0; i < A_MAX; i++) {
ABASE(i) = AMAX(i) = urole.attrbase[i]; ABASE(i) = AMAX(i) = g.urole.attrbase[i];
ATEMP(i) = ATIME(i) = 0; ATEMP(i) = ATIME(i) = 0;
np -= urole.attrbase[i]; np -= g.urole.attrbase[i];
} }
tryct = 0; tryct = 0;
while (np > 0 && tryct < 100) { while (np > 0 && tryct < 100) {
x = rn2(100); x = rn2(100);
for (i = 0; (i < A_MAX) && ((x -= urole.attrdist[i]) > 0); i++) for (i = 0; (i < A_MAX) && ((x -= g.urole.attrdist[i]) > 0); i++)
; ;
if (i >= A_MAX) if (i >= A_MAX)
continue; /* impossible */ continue; /* impossible */
@@ -626,7 +626,7 @@ register int np;
while (np < 0 && tryct < 100) { /* for redistribution */ while (np < 0 && tryct < 100) { /* for redistribution */
x = rn2(100); x = rn2(100);
for (i = 0; (i < A_MAX) && ((x -= urole.attrdist[i]) > 0); i++) for (i = 0; (i < A_MAX) && ((x -= g.urole.attrdist[i]) > 0); i++)
; ;
if (i >= A_MAX) if (i >= A_MAX)
continue; /* impossible */ continue; /* impossible */
@@ -966,30 +966,30 @@ newhp()
if (u.ulevel == 0) { if (u.ulevel == 0) {
/* Initialize hit points */ /* Initialize hit points */
hp = urole.hpadv.infix + urace.hpadv.infix; hp = g.urole.hpadv.infix + g.urace.hpadv.infix;
if (urole.hpadv.inrnd > 0) if (g.urole.hpadv.inrnd > 0)
hp += rnd(urole.hpadv.inrnd); hp += rnd(g.urole.hpadv.inrnd);
if (urace.hpadv.inrnd > 0) if (g.urace.hpadv.inrnd > 0)
hp += rnd(urace.hpadv.inrnd); hp += rnd(g.urace.hpadv.inrnd);
if (g.moves <= 1L) { /* initial hero; skip for polyself to new man */ if (g.moves <= 1L) { /* initial hero; skip for polyself to new man */
/* Initialize alignment stuff */ /* Initialize alignment stuff */
u.ualign.type = aligns[flags.initalign].value; u.ualign.type = aligns[flags.initalign].value;
u.ualign.record = urole.initrecord; u.ualign.record = g.urole.initrecord;
} }
/* no Con adjustment for initial hit points */ /* no Con adjustment for initial hit points */
} else { } else {
if (u.ulevel < urole.xlev) { if (u.ulevel < g.urole.xlev) {
hp = urole.hpadv.lofix + urace.hpadv.lofix; hp = g.urole.hpadv.lofix + g.urace.hpadv.lofix;
if (urole.hpadv.lornd > 0) if (g.urole.hpadv.lornd > 0)
hp += rnd(urole.hpadv.lornd); hp += rnd(g.urole.hpadv.lornd);
if (urace.hpadv.lornd > 0) if (g.urace.hpadv.lornd > 0)
hp += rnd(urace.hpadv.lornd); hp += rnd(g.urace.hpadv.lornd);
} else { } else {
hp = urole.hpadv.hifix + urace.hpadv.hifix; hp = g.urole.hpadv.hifix + g.urace.hpadv.hifix;
if (urole.hpadv.hirnd > 0) if (g.urole.hpadv.hirnd > 0)
hp += rnd(urole.hpadv.hirnd); hp += rnd(g.urole.hpadv.hirnd);
if (urace.hpadv.hirnd > 0) if (g.urace.hpadv.hirnd > 0)
hp += rnd(urace.hpadv.hirnd); hp += rnd(g.urace.hpadv.hirnd);
} }
if (ACURR(A_CON) <= 3) if (ACURR(A_CON) <= 3)
conplus = -2; conplus = -2;
+2 -2
View File
@@ -478,8 +478,8 @@ make_bones:
/* format name+role,&c, death reason, and date+time; /* format name+role,&c, death reason, and date+time;
gender and alignment reflect final values rather than what the gender and alignment reflect final values rather than what the
character started out as, same as topten and logfile entries */ character started out as, same as topten and logfile entries */
Sprintf(newbones->who, "%s-%.3s-%.3s-%.3s-%.3s", g.plname, urole.filecode, Sprintf(newbones->who, "%s-%.3s-%.3s-%.3s-%.3s", g.plname, g.urole.filecode,
urace.filecode, genders[flags.female].filecode, g.urace.filecode, genders[flags.female].filecode,
aligns[1 - u.ualign.type].filecode); aligns[1 - u.ualign.type].filecode);
formatkiller(newbones->how, sizeof newbones->how, how, TRUE); formatkiller(newbones->how, sizeof newbones->how, how, TRUE);
Strcpy(newbones->when, yyyymmddhhmmss(when)); Strcpy(newbones->when, yyyymmddhhmmss(when));
+7 -7
View File
@@ -40,7 +40,7 @@ get_strength_str()
void void
check_gold_symbol() check_gold_symbol()
{ {
nhsym goldch = showsyms[COIN_CLASS + SYM_OFF_O]; nhsym goldch = g.showsyms[COIN_CLASS + SYM_OFF_O];
iflags.invis_goldsym = (goldch <= (nhsym) ' '); iflags.invis_goldsym = (goldch <= (nhsym) ' ');
} }
@@ -278,7 +278,7 @@ boolean female;
if (monnum == role->malenum || monnum == role->femalenum) if (monnum == role->malenum || monnum == role->femalenum)
break; break;
if (!role->name.m) if (!role->name.m)
role = &urole; role = &g.urole;
/* Find the rank */ /* Find the rank */
for (i = xlev_to_rank((int) lev); i >= 0; i--) { for (i = xlev_to_rank((int) lev); i >= 0; i--) {
@@ -340,9 +340,9 @@ max_rank_sz()
{ {
register int i, r, maxr = 0; register int i, r, maxr = 0;
for (i = 0; i < 9; i++) { for (i = 0; i < 9; i++) {
if (urole.rank[i].m && (r = strlen(urole.rank[i].m)) > maxr) if (g.urole.rank[i].m && (r = strlen(g.urole.rank[i].m)) > maxr)
maxr = r; maxr = r;
if (urole.rank[i].f && (r = strlen(urole.rank[i].f)) > maxr) if (g.urole.rank[i].f && (r = strlen(g.urole.rank[i].f)) > maxr)
maxr = r; maxr = r;
} }
g.mrank_sz = maxr; g.mrank_sz = maxr;
@@ -3157,9 +3157,9 @@ choose_value:
int i, j, rv; int i, j, rv;
for (i = j = 0; i < 9; i++) { for (i = j = 0; i < 9; i++) {
Sprintf(mbuf, "\"%s\"", urole.rank[i].m); Sprintf(mbuf, "\"%s\"", g.urole.rank[i].m);
if (urole.rank[i].f) { if (g.urole.rank[i].f) {
Sprintf(fbuf, "\"%s\"", urole.rank[i].f); Sprintf(fbuf, "\"%s\"", g.urole.rank[i].f);
Sprintf(obuf, "%s or %s", Sprintf(obuf, "%s or %s",
flags.female ? fbuf : mbuf, flags.female ? fbuf : mbuf,
flags.female ? mbuf : fbuf); flags.female ? mbuf : fbuf);
+15 -15
View File
@@ -1705,9 +1705,9 @@ int final; /* ENL_GAMEINPROGRESS:0, ENL_GAMEOVERALIVE, ENL_GAMEOVERDEAD */
/* as in background_enlightenment, when poly'd we need to use the saved /* as in background_enlightenment, when poly'd we need to use the saved
gender in u.mfemale rather than the current you-as-monster gender */ gender in u.mfemale rather than the current you-as-monster gender */
Sprintf(buf, "%s the %s's attributes:", tmpbuf, Sprintf(buf, "%s the %s's attributes:", tmpbuf,
((Upolyd ? u.mfemale : flags.female) && urole.name.f) ((Upolyd ? u.mfemale : flags.female) && g.urole.name.f)
? urole.name.f ? g.urole.name.f
: urole.name.m); : g.urole.name.m);
/* title */ /* title */
enlght_out(buf); /* "Conan the Archeologist's attributes:" */ enlght_out(buf); /* "Conan the Archeologist's attributes:" */
@@ -1761,7 +1761,7 @@ int final;
/* note that if poly'd, we need to use u.mfemale instead of flags.female /* note that if poly'd, we need to use u.mfemale instead of flags.female
to access hero's saved gender-as-human/elf/&c rather than current one */ to access hero's saved gender-as-human/elf/&c rather than current one */
innategend = (Upolyd ? u.mfemale : flags.female) ? 1 : 0; innategend = (Upolyd ? u.mfemale : flags.female) ? 1 : 0;
role_titl = (innategend && urole.name.f) ? urole.name.f : urole.name.m; role_titl = (innategend && g.urole.name.f) ? g.urole.name.f : g.urole.name.m;
rank_titl = rank_of(u.ulevel, Role_switch, innategend); rank_titl = rank_of(u.ulevel, Role_switch, innategend);
enlght_out(""); /* separator after title */ enlght_out(""); /* separator after title */
@@ -1787,8 +1787,8 @@ int final;
/* report role; omit gender if it's redundant (eg, "female priestess") */ /* report role; omit gender if it's redundant (eg, "female priestess") */
tmpbuf[0] = '\0'; tmpbuf[0] = '\0';
if (!urole.name.f if (!g.urole.name.f
&& ((urole.allow & ROLE_GENDMASK) == (ROLE_MALE | ROLE_FEMALE) && ((g.urole.allow & ROLE_GENDMASK) == (ROLE_MALE | ROLE_FEMALE)
|| innategend != flags.initgend)) || innategend != flags.initgend))
Sprintf(tmpbuf, "%s ", genders[innategend].adj); Sprintf(tmpbuf, "%s ", genders[innategend].adj);
buf[0] = '\0'; buf[0] = '\0';
@@ -1797,10 +1797,10 @@ int final;
if (!strcmpi(rank_titl, role_titl)) { if (!strcmpi(rank_titl, role_titl)) {
/* omit role when rank title matches it */ /* omit role when rank title matches it */
Sprintf(eos(buf), "%s, level %d %s%s", an(rank_titl), u.ulevel, Sprintf(eos(buf), "%s, level %d %s%s", an(rank_titl), u.ulevel,
tmpbuf, urace.noun); tmpbuf, g.urace.noun);
} else { } else {
Sprintf(eos(buf), "%s, a level %d %s%s %s", an(rank_titl), u.ulevel, Sprintf(eos(buf), "%s, a level %d %s%s %s", an(rank_titl), u.ulevel,
tmpbuf, urace.adj, role_titl); tmpbuf, g.urace.adj, role_titl);
} }
you_are(buf, ""); you_are(buf, "");
@@ -2927,10 +2927,10 @@ minimal_enlightenment()
/* Starting name, race, role, gender */ /* Starting name, race, role, gender */
Sprintf(buf, fmtstr, "name", g.plname); Sprintf(buf, fmtstr, "name", g.plname);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
Sprintf(buf, fmtstr, "race", urace.noun); Sprintf(buf, fmtstr, "race", g.urace.noun);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
Sprintf(buf, fmtstr, "role", Sprintf(buf, fmtstr, "role",
(flags.initgend && urole.name.f) ? urole.name.f : urole.name.m); (flags.initgend && g.urole.name.f) ? g.urole.name.f : g.urole.name.m);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
Sprintf(buf, fmtstr, "gender", genders[flags.initgend].adj); Sprintf(buf, fmtstr, "gender", genders[flags.initgend].adj);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
@@ -2943,17 +2943,17 @@ minimal_enlightenment()
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", FALSE); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", FALSE);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings, add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings,
"Current", FALSE); "Current", FALSE);
Sprintf(buf, fmtstr, "race", Upolyd ? g.youmonst.data->mname : urace.noun); Sprintf(buf, fmtstr, "race", Upolyd ? g.youmonst.data->mname : g.urace.noun);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
if (Upolyd) { if (Upolyd) {
Sprintf(buf, fmtstr, "role (base)", Sprintf(buf, fmtstr, "role (base)",
(u.mfemale && urole.name.f) ? urole.name.f (u.mfemale && g.urole.name.f) ? g.urole.name.f
: urole.name.m); : g.urole.name.m);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
} else { } else {
Sprintf(buf, fmtstr, "role", Sprintf(buf, fmtstr, "role",
(flags.female && urole.name.f) ? urole.name.f (flags.female && g.urole.name.f) ? g.urole.name.f
: urole.name.m); : g.urole.name.m);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
} }
/* don't want poly_gender() here; it forces `2' for non-humanoids */ /* don't want poly_gender() here; it forces `2' for non-humanoids */
+89
View File
@@ -151,6 +151,53 @@ unsigned nhUse_dummy = 0;
#pragma GCC diagnostic ignored "-Wmissing-braces" #pragma GCC diagnostic ignored "-Wmissing-braces"
#endif #endif
const struct Role urole_init_data = {
{ "Undefined", 0 },
{ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } },
"L", "N", "C",
"Xxx", "home", "locate",
NON_PM, NON_PM, NON_PM, NON_PM, NON_PM, NON_PM, NON_PM, NON_PM,
0, 0, 0, 0,
/* Str Int Wis Dex Con Cha */
{ 7, 7, 7, 7, 7, 7 },
{ 20, 15, 15, 20, 20, 10 },
/* Init Lower Higher */
{ 10, 0, 0, 8, 1, 0 }, /* Hit points */
{ 2, 0, 0, 2, 0, 3 },
14, /* Energy */
0,
10,
0,
0,
4,
A_INT,
0,
-3
};
const struct Race urace_init_data = {
"something",
"undefined",
"something",
"Xxx",
{ 0, 0 },
NON_PM,
NON_PM,
NON_PM,
NON_PM,
0,
0,
0,
0,
/* Str Int Wis Dex Con Cha */
{ 3, 3, 3, 3, 3, 3 },
{ STR18(100), 18, 18, 18, 18, 18 },
/* Init Lower Higher */
{ 2, 0, 0, 2, 1, 0 }, /* Hit points */
{ 1, 0, 2, 0, 2, 0 } /* Energy */
};
const struct instance_globals g_init = { const struct instance_globals g_init = {
/* apply.c */ /* apply.c */
0, /* jumping_is_magic */ 0, /* jumping_is_magic */
@@ -443,6 +490,11 @@ const struct instance_globals g_init = {
NULL, /* animal_list */ NULL, /* animal_list */
UNDEFINED_VALUE, /* animal_list_count */ UNDEFINED_VALUE, /* animal_list_count */
/* mthrowu.c */
UNDEFINED_VALUE, /* mesg_given */
NULL, /* mtarget */
NULL, /* marcher */
/* muse.c */ /* muse.c */
FALSE, /* m_using */ FALSE, /* m_using */
UNDEFINED_VALUE, /* trapx */ UNDEFINED_VALUE, /* trapx */
@@ -450,6 +502,12 @@ const struct instance_globals g_init = {
UNDEFINED_VALUE, /* zap_oseen */ UNDEFINED_VALUE, /* zap_oseen */
UNDEFINED_VALUES, /* m */ UNDEFINED_VALUES, /* m */
/* nhlan.c */
#ifdef MAX_LAN_USERNAME
UNDEFINED_VALUES, /* lusername */
MAX_LAN_USERNAME, /* lusername_size */
#endif /* MAX_LAN_USERNAME */
/* o_init.c */ /* o_init.c */
DUMMY, /* disco */ DUMMY, /* disco */
@@ -458,6 +516,12 @@ const struct instance_globals g_init = {
/* options.c */ /* options.c */
NULL, /* symset_list */ NULL, /* symset_list */
UNDEFINED_VALUES, /* mapped_menu_cmds */
UNDEFINED_VALUES, /* mapped_menu_op */
0, /* n_menu_mapped */
UNDEFINED_VALUE, /* opt_initial */
UNDEFINED_VALUE, /* opt_from_file */
UNDEFINED_VALUE, /* opt_need_redraw */
/* pickup.c */ /* pickup.c */
0, /* oldcap */ 0, /* oldcap */
@@ -504,6 +568,11 @@ const struct instance_globals g_init = {
/* read.c */ /* read.c */
UNDEFINED_VALUE, /* known */ UNDEFINED_VALUE, /* known */
/* region.c */
NULL, /* regions */
0, /* n_regions */
0, /* max_regions */
/* restore.c */ /* restore.c */
0, /* n_ids_mapped */ 0, /* n_ids_mapped */
0, /* id_map */ 0, /* id_map */
@@ -511,6 +580,16 @@ const struct instance_globals g_init = {
UNDEFINED_PTR, /* oldfruit */ UNDEFINED_PTR, /* oldfruit */
UNDEFINED_VALUE, /* omoves */ UNDEFINED_VALUE, /* omoves */
/* rip.c */
UNDEFINED_PTR, /* rip */
/* role.c */
UNDEFINED_VALUES, /* urole */
UNDEFINED_VALUES, /* urace */
UNDEFINED_VALUES, /* role_pa */
UNDEFINED_VALUE, /* role_post_attrib */
UNDEFINED_VALUES, /* rfilter */
/* rumors.c */ /* rumors.c */
0, /* true_rumor_size */ 0, /* true_rumor_size */
0, /* false_rumor_size */ 0, /* false_rumor_size */
@@ -532,6 +611,7 @@ const struct instance_globals g_init = {
SELL_NORMAL, /* sell_how */ SELL_NORMAL, /* sell_how */
FALSE, /* auto_credit */ FALSE, /* auto_credit */
UNDEFINED_VALUES, /* repo */ UNDEFINED_VALUES, /* repo */
UNDEFINED_VALUE, /* followmsg */
/* sp_lev.c */ /* sp_lev.c */
NULL, /* lev_message */ NULL, /* lev_message */
@@ -555,12 +635,18 @@ const struct instance_globals g_init = {
0, /* spl_sortmode */ 0, /* spl_sortmode */
NULL, /* spl_orderindx */ NULL, /* spl_orderindx */
/* teleport.c */
NULL, /* telescroll */
/* timeout.c */ /* timeout.c */
UNDEFINED_PTR, /* timer_base */ UNDEFINED_PTR, /* timer_base */
1, /* timer_id */ 1, /* timer_id */
/* topten.c */ /* topten.c */
WIN_ERR, /* topten */ WIN_ERR, /* topten */
#ifdef UPDATE_RECORD_IN_PLACE
UNDEFINED_VALUE, /* final_fpos */
#endif
/* trap.c */ /* trap.c */
0, /* force_mintrap */ 0, /* force_mintrap */
@@ -635,6 +721,9 @@ decl_globals_init()
WIN_MESSAGE = WIN_STATUS = WIN_MAP = WIN_INVEN = WIN_ERR; WIN_MESSAGE = WIN_STATUS = WIN_MAP = WIN_INVEN = WIN_ERR;
g.urole = urole_init_data;
g.urace = urace_init_data;
} }
+3 -3
View File
@@ -1528,9 +1528,9 @@ namefloorobj()
char tmpbuf[BUFSZ]; char tmpbuf[BUFSZ];
/* straight role name */ /* straight role name */
unames[0] = ((Upolyd ? u.mfemale : flags.female) && urole.name.f) unames[0] = ((Upolyd ? u.mfemale : flags.female) && g.urole.name.f)
? urole.name.f ? g.urole.name.f
: urole.name.m; : g.urole.name.m;
/* random rank title for hero's role */ /* random rank title for hero's role */
unames[1] = rank_of(rnd(30), Role_switch, flags.female); unames[1] = rank_of(rnd(30), Role_switch, flags.female);
/* random fake monster */ /* random fake monster */
+2 -2
View File
@@ -61,8 +61,8 @@ register struct monst *mtmp;
STATIC_OVL int STATIC_OVL int
pet_type() pet_type()
{ {
if (urole.petnum != NON_PM) if (g.urole.petnum != NON_PM)
return urole.petnum; return g.urole.petnum;
else if (g.preferred_pet == 'c') else if (g.preferred_pet == 'c')
return PM_KITTEN; return PM_KITTEN;
else if (g.preferred_pet == 'd') else if (g.preferred_pet == 'd')
+1 -1
View File
@@ -923,7 +923,7 @@ init_dungeons()
/* This is where the name substitution on the /* This is where the name substitution on the
* levels of the quest dungeon occur. * levels of the quest dungeon occur.
*/ */
Sprintf(x->proto, "%s%s", urole.filecode, Sprintf(x->proto, "%s%s", g.urole.filecode,
&lev_map->lev_name[1]); &lev_map->lev_name[1]);
} else if (lev_map->lev_spec == &knox_level) { } else if (lev_map->lev_spec == &knox_level) {
branch *br; branch *br;
+2 -2
View File
@@ -1030,7 +1030,7 @@ int pm;
Hallucination Hallucination
? "You suddenly dread being peeled and mimic %s again!" ? "You suddenly dread being peeled and mimic %s again!"
: "You now prefer mimicking %s again.", : "You now prefer mimicking %s again.",
an(Upolyd ? g.youmonst.data->mname : urace.noun)); an(Upolyd ? g.youmonst.data->mname : g.urace.noun));
g.eatmbuf = dupstr(buf); g.eatmbuf = dupstr(buf);
g.nomovemsg = g.eatmbuf; g.nomovemsg = g.eatmbuf;
g.afternmv = eatmdone; g.afternmv = eatmdone;
@@ -3041,7 +3041,7 @@ boolean incr;
|| Role_if(PM_VALKYRIE))) || Role_if(PM_VALKYRIE)))
pline("%s needs food, badly!", pline("%s needs food, badly!",
(Role_if(PM_WIZARD) || Role_if(PM_VALKYRIE)) (Role_if(PM_WIZARD) || Role_if(PM_VALKYRIE))
? urole.name.m ? g.urole.name.m
: "Elf"); : "Elf");
else else
You((!incr) You((!incr)
+10 -10
View File
@@ -480,8 +480,8 @@ int how;
Strcpy(g.killer.name, buf); Strcpy(g.killer.name, buf);
if (mptr->mlet == S_WRAITH) if (mptr->mlet == S_WRAITH)
u.ugrave_arise = PM_WRAITH; u.ugrave_arise = PM_WRAITH;
else if (mptr->mlet == S_MUMMY && urace.mummynum != NON_PM) else if (mptr->mlet == S_MUMMY && g.urace.mummynum != NON_PM)
u.ugrave_arise = urace.mummynum; u.ugrave_arise = g.urace.mummynum;
else if (mptr->mlet == S_VAMPIRE && Race_if(PM_HUMAN)) else if (mptr->mlet == S_VAMPIRE && Race_if(PM_HUMAN))
u.ugrave_arise = PM_VAMPIRE; u.ugrave_arise = PM_VAMPIRE;
else if (mptr == &mons[PM_GHOUL]) else if (mptr == &mons[PM_GHOUL])
@@ -718,8 +718,8 @@ time_t when; /* date+time at end of game */
Sprintf(pbuf, "%s, %s %s %s %s", g.plname, Sprintf(pbuf, "%s, %s %s %s %s", g.plname,
aligns[1 - u.ualign.type].adj, aligns[1 - u.ualign.type].adj,
genders[flags.female].adj, genders[flags.female].adj,
urace.adj, g.urace.adj,
(flags.female && urole.name.f) ? urole.name.f : urole.name.m); (flags.female && g.urole.name.f) ? g.urole.name.f : g.urole.name.m);
putstr(0, 0, pbuf); putstr(0, 0, pbuf);
putstr(0, 0, ""); putstr(0, 0, "");
@@ -1266,9 +1266,9 @@ int how;
* u.umonnum is based on role, and all role monsters * u.umonnum is based on role, and all role monsters
* are human. * are human.
*/ */
mnum = (flags.female && urace.femalenum != NON_PM) mnum = (flags.female && g.urace.femalenum != NON_PM)
? urace.femalenum ? g.urace.femalenum
: urace.malenum; : g.urace.malenum;
} }
corpse = mk_named_object(CORPSE, &mons[mnum], u.ux, u.uy, g.plname); corpse = mk_named_object(CORPSE, &mons[mnum], u.ux, u.uy, g.plname);
Sprintf(pbuf, "%s, ", g.plname); Sprintf(pbuf, "%s, ", g.plname);
@@ -1376,9 +1376,9 @@ int how;
Sprintf(pbuf, "%s %s the %s...", Goodbye(), g.plname, Sprintf(pbuf, "%s %s the %s...", Goodbye(), g.plname,
(how != ASCENDED) (how != ASCENDED)
? (const char *) ((flags.female && urole.name.f) ? (const char *) ((flags.female && g.urole.name.f)
? urole.name.f ? g.urole.name.f
: urole.name.m) : g.urole.name.m)
: (const char *) (flags.female ? "Demigoddess" : "Demigod")); : (const char *) (flags.female ? "Demigoddess" : "Demigod"));
dump_forward_putstr(endwin, 0, pbuf, done_stopprint); dump_forward_putstr(endwin, 0, pbuf, done_stopprint);
dump_forward_putstr(endwin, 0, "", done_stopprint); dump_forward_putstr(endwin, 0, "", done_stopprint);
+10 -10
View File
@@ -47,19 +47,19 @@ newpw()
int en = 0, enrnd, enfix; int en = 0, enrnd, enfix;
if (u.ulevel == 0) { if (u.ulevel == 0) {
en = urole.enadv.infix + urace.enadv.infix; en = g.urole.enadv.infix + g.urace.enadv.infix;
if (urole.enadv.inrnd > 0) if (g.urole.enadv.inrnd > 0)
en += rnd(urole.enadv.inrnd); en += rnd(g.urole.enadv.inrnd);
if (urace.enadv.inrnd > 0) if (g.urace.enadv.inrnd > 0)
en += rnd(urace.enadv.inrnd); en += rnd(g.urace.enadv.inrnd);
} else { } else {
enrnd = (int) ACURR(A_WIS) / 2; enrnd = (int) ACURR(A_WIS) / 2;
if (u.ulevel < urole.xlev) { if (u.ulevel < g.urole.xlev) {
enrnd += urole.enadv.lornd + urace.enadv.lornd; enrnd += g.urole.enadv.lornd + g.urace.enadv.lornd;
enfix = urole.enadv.lofix + urace.enadv.lofix; enfix = g.urole.enadv.lofix + g.urace.enadv.lofix;
} else { } else {
enrnd += urole.enadv.hirnd + urace.enadv.hirnd; enrnd += g.urole.enadv.hirnd + g.urace.enadv.hirnd;
enfix = urole.enadv.hifix + urace.enadv.hifix; enfix = g.urole.enadv.hifix + g.urace.enadv.hifix;
} }
en = enermod(rn1(enrnd, enfix)); en = enermod(rn1(enrnd, enfix));
} }
+1 -1
View File
@@ -696,7 +696,7 @@ d_level *lev;
first letter of the role's filecode; bones loading still worked first letter of the role's filecode; bones loading still worked
because the bonesid used for validation had the same error */ because the bonesid used for validation had the same error */
Sprintf(dptr, "%c%s", g.dungeons[lev->dnum].boneid, Sprintf(dptr, "%c%s", g.dungeons[lev->dnum].boneid,
In_quest(lev) ? urole.filecode : "0"); In_quest(lev) ? g.urole.filecode : "0");
if ((sptr = Is_special(lev)) != 0) if ((sptr = Is_special(lev)) != 0)
Sprintf(eos(dptr), ".%c", sptr->boneid); Sprintf(eos(dptr), ".%c", sptr->boneid);
else else
+1 -1
View File
@@ -2871,7 +2871,7 @@ maybe_wail()
const char *who; const char *who;
int i, powercnt; int i, powercnt;
who = (Role_if(PM_WIZARD) || Role_if(PM_VALKYRIE)) ? urole.name.m who = (Role_if(PM_WIZARD) || Role_if(PM_VALKYRIE)) ? g.urole.name.m
: "Elf"; : "Elf";
if (u.uhp == 1) { if (u.uhp == 1) {
pline("%s is about to die.", who); pline("%s is about to die.", who);
+2 -2
View File
@@ -670,10 +670,10 @@ makelevel()
char fillname[9]; char fillname[9];
s_level *loc_lev; s_level *loc_lev;
Sprintf(fillname, "%s-loca", urole.filecode); Sprintf(fillname, "%s-loca", g.urole.filecode);
loc_lev = find_level(fillname); loc_lev = find_level(fillname);
Sprintf(fillname, "%s-fil", urole.filecode); Sprintf(fillname, "%s-fil", g.urole.filecode);
Strcat(fillname, Strcat(fillname,
(u.uz.dlevel < loc_lev->dlevel.dlevel) ? "a" : "b"); (u.uz.dlevel < loc_lev->dlevel.dlevel) ? "a" : "b");
makemaz(fillname); makemaz(fillname);
+1 -1
View File
@@ -1055,7 +1055,7 @@ boolean artif;
if (otmp->corpsenm == NON_PM) { if (otmp->corpsenm == NON_PM) {
otmp->corpsenm = undead_to_corpse(rndmonnum()); otmp->corpsenm = undead_to_corpse(rndmonnum());
if (g.mvitals[otmp->corpsenm].mvflags & (G_NOCORPSE | G_GONE)) if (g.mvitals[otmp->corpsenm].mvflags & (G_NOCORPSE | G_GONE))
otmp->corpsenm = urole.malenum; otmp->corpsenm = g.urole.malenum;
} }
/*FALLTHRU*/ /*FALLTHRU*/
case STATUE: case STATUE:
+1 -1
View File
@@ -3323,7 +3323,7 @@ struct monst *mon;
} else if (!rn2(3)) { /* quest guardians */ } else if (!rn2(3)) { /* quest guardians */
mndx = rn1(PM_APPRENTICE - PM_STUDENT + 1, PM_STUDENT); mndx = rn1(PM_APPRENTICE - PM_STUDENT + 1, PM_STUDENT);
/* avoid own role's guardian */ /* avoid own role's guardian */
if (mndx == urole.guardnum) if (mndx == g.urole.guardnum)
mndx = NON_PM; mndx = NON_PM;
} else { /* general humanoids */ } else { /* general humanoids */
tryct = 5; tryct = 5;
+1 -1
View File
@@ -1076,7 +1076,7 @@ raceptr(mtmp)
struct monst *mtmp; struct monst *mtmp;
{ {
if (mtmp == &g.youmonst && !Upolyd) if (mtmp == &g.youmonst && !Upolyd)
return &mons[urace.malenum]; return &mons[g.urace.malenum];
else else
return mtmp->data; return mtmp->data;
} }
+2 -2
View File
@@ -3237,8 +3237,8 @@ monst_globals_init()
return; return;
} }
struct attack sa_yes[NATTK] = SEDUCTION_ATTACKS_YES; const struct attack c_sa_yes[NATTK] = SEDUCTION_ATTACKS_YES;
struct attack sa_no[NATTK] = SEDUCTION_ATTACKS_NO; const struct attack c_sa_no[NATTK] = SEDUCTION_ATTACKS_NO;
#endif #endif
/*monst.c*/ /*monst.c*/
+2 -2
View File
@@ -376,8 +376,8 @@ register struct monst *mtmp;
if (mtmp->mpeaceful) if (mtmp->mpeaceful)
return; /* will drop to humanoid talk */ return; /* will drop to humanoid talk */
pline("Talk? -- %s", (mtmp->data == &mons[urole.malenum] pline("Talk? -- %s", (mtmp->data == &mons[g.urole.malenum]
|| mtmp->data == &mons[urole.femalenum]) || mtmp->data == &mons[g.urole.femalenum])
? same_class_msg[rn2(3)] ? same_class_msg[rn2(3)]
: other_class_msg[rn2(3)]); : other_class_msg[rn2(3)]);
} }
+21 -28
View File
@@ -26,8 +26,6 @@ STATIC_OVL NEARDATA const char *breathwep[] = {
"strange breath #9" "strange breath #9"
}; };
STATIC_VAR int mesg_given; /* for m_throw()/thitu() 'miss' message */
/* hero is hit by something other than a monster */ /* hero is hit by something other than a monster */
int int
thitu(tlev, dam, objp, name) thitu(tlev, dam, objp, name)
@@ -61,7 +59,7 @@ const char *name; /* if null, then format `*objp' */
is_acid = (obj && obj->otyp == ACID_VENOM); is_acid = (obj && obj->otyp == ACID_VENOM);
if (u.uac + tlev <= (dieroll = rnd(20))) { if (u.uac + tlev <= (dieroll = rnd(20))) {
++mesg_given; ++g.mesg_given;
if (Blind || !flags.verbose) { if (Blind || !flags.verbose) {
pline("It misses."); pline("It misses.");
} else if (u.uac + tlev <= dieroll - 2) { } else if (u.uac + tlev <= dieroll - 2) {
@@ -146,11 +144,6 @@ int x, y;
return retvalu; return retvalu;
} }
/* The monster that's being shot at when one monster shoots at another */
STATIC_OVL struct monst *target = 0;
/* The monster that's doing the shooting/throwing */
STATIC_OVL struct monst *archer = 0;
/* calculate multishot volley count for mtmp throwing otmp (if not ammo) or /* calculate multishot volley count for mtmp throwing otmp (if not ammo) or
shooting otmp with mwep (if otmp is ammo and mwep appropriate launcher) */ shooting otmp with mwep (if otmp is ammo and mwep appropriate launcher) */
STATIC_OVL int STATIC_OVL int
@@ -243,7 +236,7 @@ monshoot(mtmp, otmp, mwep)
struct monst *mtmp; struct monst *mtmp;
struct obj *otmp, *mwep; struct obj *otmp, *mwep;
{ {
struct monst *mtarg = target; struct monst *mtarg = g.mtarget;
int dm = distmin(mtmp->mx, mtmp->my, int dm = distmin(mtmp->mx, mtmp->my,
mtarg ? mtarg->mx : mtmp->mux, mtarg ? mtarg->mx : mtmp->mux,
mtarg ? mtarg->my : mtmp->muy), mtarg ? mtarg->my : mtmp->muy),
@@ -309,7 +302,7 @@ boolean verbose; /* give message(s) even when you can't see what happened */
int damage, tmp; int damage, tmp;
boolean vis, ismimic; boolean vis, ismimic;
int objgone = 1; int objgone = 1;
struct obj *mon_launcher = archer ? MON_WEP(archer) : NULL; struct obj *mon_launcher = g.marcher ? MON_WEP(g.marcher) : NULL;
g.notonhead = (g.bhitpos.x != mtmp->mx || g.bhitpos.y != mtmp->my); g.notonhead = (g.bhitpos.x != mtmp->mx || g.bhitpos.y != mtmp->my);
ismimic = mtmp->m_ap_type && mtmp->m_ap_type != M_AP_MONSTER; ismimic = mtmp->m_ap_type && mtmp->m_ap_type != M_AP_MONSTER;
@@ -319,9 +312,9 @@ boolean verbose; /* give message(s) even when you can't see what happened */
/* High level monsters will be more likely to hit */ /* High level monsters will be more likely to hit */
/* This check applies only if this monster is the target /* This check applies only if this monster is the target
* the archer was aiming at. */ * the archer was aiming at. */
if (archer && target == mtmp) { if (g.marcher && g.mtarget == mtmp) {
if (archer->m_lev > 5) if (g.marcher->m_lev > 5)
tmp += archer->m_lev - 5; tmp += g.marcher->m_lev - 5;
if (mon_launcher && mon_launcher->oartifact) if (mon_launcher && mon_launcher->oartifact)
tmp += spec_abon(mon_launcher, mtmp); tmp += spec_abon(mon_launcher, mtmp);
} }
@@ -329,7 +322,7 @@ boolean verbose; /* give message(s) even when you can't see what happened */
if (!ismimic) { if (!ismimic) {
if (vis) if (vis)
miss(distant_name(otmp, mshot_xname), mtmp); miss(distant_name(otmp, mshot_xname), mtmp);
else if (verbose && !target) else if (verbose && !g.mtarget)
pline("It is missed."); pline("It is missed.");
} }
if (!range) { /* Last position; object drops */ if (!range) { /* Last position; object drops */
@@ -359,7 +352,7 @@ boolean verbose; /* give message(s) even when you can't see what happened */
otmp->known ? an(mons[otmp->corpsenm].mname) : "an"); otmp->known ? an(mons[otmp->corpsenm].mname) : "an");
else else
hit(distant_name(otmp, mshot_xname), mtmp, exclam(damage)); hit(distant_name(otmp, mshot_xname), mtmp, exclam(damage));
} else if (verbose && !target) } else if (verbose && !g.mtarget)
pline("%s%s is hit%s", (otmp->otyp == EGG) ? "Splat! " : "", pline("%s%s is hit%s", (otmp->otyp == EGG) ? "Splat! " : "",
Monnam(mtmp), exclam(damage)); Monnam(mtmp), exclam(damage));
@@ -382,17 +375,17 @@ boolean verbose; /* give message(s) even when you can't see what happened */
&& mon_hates_silver(mtmp)) { && mon_hates_silver(mtmp)) {
if (vis) if (vis)
pline_The("silver sears %s flesh!", s_suffix(mon_nam(mtmp))); pline_The("silver sears %s flesh!", s_suffix(mon_nam(mtmp)));
else if (verbose && !target) else if (verbose && !g.mtarget)
pline("Its flesh is seared!"); pline("Its flesh is seared!");
} }
if (otmp->otyp == ACID_VENOM && cansee(mtmp->mx, mtmp->my)) { if (otmp->otyp == ACID_VENOM && cansee(mtmp->mx, mtmp->my)) {
if (resists_acid(mtmp)) { if (resists_acid(mtmp)) {
if (vis || (verbose && !target)) if (vis || (verbose && !g.mtarget))
pline("%s is unaffected.", Monnam(mtmp)); pline("%s is unaffected.", Monnam(mtmp));
} else { } else {
if (vis) if (vis)
pline_The("%s burns %s!", hliquid("acid"), mon_nam(mtmp)); pline_The("%s burns %s!", hliquid("acid"), mon_nam(mtmp));
else if (verbose && !target) else if (verbose && !g.mtarget)
pline("It is burned!"); pline("It is burned!");
} }
} }
@@ -406,7 +399,7 @@ boolean verbose; /* give message(s) even when you can't see what happened */
if (!DEADMONSTER(mtmp)) { /* might already be dead (if petrified) */ if (!DEADMONSTER(mtmp)) { /* might already be dead (if petrified) */
mtmp->mhp -= damage; mtmp->mhp -= damage;
if (DEADMONSTER(mtmp)) { if (DEADMONSTER(mtmp)) {
if (vis || (verbose && !target)) if (vis || (verbose && !g.mtarget))
pline("%s is %s!", Monnam(mtmp), pline("%s is %s!", Monnam(mtmp),
(nonliving(mtmp->data) || is_vampshifter(mtmp) (nonliving(mtmp->data) || is_vampshifter(mtmp)
|| !canspotmon(mtmp)) ? "destroyed" : "killed"); || !canspotmon(mtmp)) ? "destroyed" : "killed");
@@ -524,7 +517,7 @@ struct obj *obj; /* missile (or stack providing it) */
(void) drop_throw(singleobj, 0, g.bhitpos.x, g.bhitpos.y); (void) drop_throw(singleobj, 0, g.bhitpos.x, g.bhitpos.y);
return; return;
} }
mesg_given = 0; /* a 'missile misses' message has not yet been shown */ g.mesg_given = 0; /* a 'missile misses' message has not yet been shown */
/* Note: drop_throw may destroy singleobj. Since obj must be destroyed /* Note: drop_throw may destroy singleobj. Since obj must be destroyed
* early to avoid the dagger bug, anyone who modifies this code should * early to avoid the dagger bug, anyone who modifies this code should
@@ -654,9 +647,9 @@ struct obj *obj; /* missile (or stack providing it) */
|| MT_FLIGHTCHECK(FALSE)) { || MT_FLIGHTCHECK(FALSE)) {
if (singleobj) { /* hits_bars might have destroyed it */ if (singleobj) { /* hits_bars might have destroyed it */
if (g.m_shot.n > 1 if (g.m_shot.n > 1
&& (!mesg_given || g.bhitpos.x != u.ux || g.bhitpos.y != u.uy) && (!g.mesg_given || g.bhitpos.x != u.ux || g.bhitpos.y != u.uy)
&& (cansee(g.bhitpos.x, g.bhitpos.y) && (cansee(g.bhitpos.x, g.bhitpos.y)
|| (archer && canseemon(archer)))) || (g.marcher && canseemon(g.marcher))))
pline("%s misses.", The(mshot_xname(singleobj))); pline("%s misses.", The(mshot_xname(singleobj)));
(void) drop_throw(singleobj, 0, g.bhitpos.x, g.bhitpos.y); (void) drop_throw(singleobj, 0, g.bhitpos.x, g.bhitpos.y);
} }
@@ -668,7 +661,7 @@ struct obj *obj; /* missile (or stack providing it) */
tmp_at(g.bhitpos.x, g.bhitpos.y); tmp_at(g.bhitpos.x, g.bhitpos.y);
delay_output(); delay_output();
tmp_at(DISP_END, 0); tmp_at(DISP_END, 0);
mesg_given = 0; /* reset */ g.mesg_given = 0; /* reset */
if (blindinc) { if (blindinc) {
u.ucreamed += blindinc; u.ucreamed += blindinc;
@@ -717,10 +710,10 @@ struct monst *mtmp, *mtarg;
> PET_MISSILE_RANGE2) > PET_MISSILE_RANGE2)
return 0; /* Out of range */ return 0; /* Out of range */
/* Set target monster */ /* Set target monster */
target = mtarg; g.mtarget = mtarg;
archer = mtmp; g.marcher = mtmp;
monshoot(mtmp, otmp, mwep); /* multishot shooting or throwing */ monshoot(mtmp, otmp, mwep); /* multishot shooting or throwing */
archer = target = (struct monst *) 0; g.marcher = g.mtarget = (struct monst *) 0;
nomul(0); nomul(0);
return 1; return 1;
} }
@@ -758,10 +751,10 @@ struct attack *mattk;
if (!rn2(BOLT_LIM-distmin(mtmp->mx,mtmp->my,mtarg->mx,mtarg->my))) { if (!rn2(BOLT_LIM-distmin(mtmp->mx,mtmp->my,mtarg->mx,mtarg->my))) {
if (canseemon(mtmp)) if (canseemon(mtmp))
pline("%s spits venom!", Monnam(mtmp)); pline("%s spits venom!", Monnam(mtmp));
target = mtarg; g.mtarget = mtarg;
m_throw(mtmp, mtmp->mx, mtmp->my, sgn(g.tbx), sgn(g.tby), m_throw(mtmp, mtmp->mx, mtmp->my, sgn(g.tbx), sgn(g.tby),
distmin(mtmp->mx,mtmp->my,mtarg->mx,mtarg->my), otmp); distmin(mtmp->mx,mtmp->my,mtarg->mx,mtarg->my), otmp);
target = (struct monst *)0; g.mtarget = (struct monst *)0;
nomul(0); nomul(0);
/* If this is a pet, it'll get hungry. Minions and /* If this is a pet, it'll get hungry. Minions and
+52 -64
View File
@@ -459,7 +459,6 @@ static struct Bool_Opt boolopt[SIZE(boolopt_init)];
extern char configfile[]; /* for messages */ extern char configfile[]; /* for messages */
extern struct symparse loadsyms[]; extern struct symparse loadsyms[];
static boolean need_redraw; /* for doset() */
#if defined(TOS) && defined(TEXTCOLOR) #if defined(TOS) && defined(TEXTCOLOR)
extern boolean colors_changed; /* in tos.c */ extern boolean colors_changed; /* in tos.c */
@@ -470,7 +469,7 @@ extern char *shade[3]; /* in sys/msdos/video.c */
extern char ttycolors[CLR_MAX]; /* in sys/msdos/video.c */ extern char ttycolors[CLR_MAX]; /* in sys/msdos/video.c */
#endif #endif
static char def_inv_order[MAXOCLASSES] = { static const char def_inv_order[MAXOCLASSES] = {
COIN_CLASS, AMULET_CLASS, WEAPON_CLASS, ARMOR_CLASS, FOOD_CLASS, COIN_CLASS, AMULET_CLASS, WEAPON_CLASS, ARMOR_CLASS, FOOD_CLASS,
SCROLL_CLASS, SPBOOK_CLASS, POTION_CLASS, RING_CLASS, WAND_CLASS, SCROLL_CLASS, SPBOOK_CLASS, POTION_CLASS, RING_CLASS, WAND_CLASS,
TOOL_CLASS, GEM_CLASS, ROCK_CLASS, BALL_CLASS, CHAIN_CLASS, 0, TOOL_CLASS, GEM_CLASS, ROCK_CLASS, BALL_CLASS, CHAIN_CLASS, 0,
@@ -523,17 +522,6 @@ static const menu_cmd_t default_menu_cmd_info[] = {
{ "menu_search", MENU_SEARCH, "Search and toggle matching items" }, { "menu_search", MENU_SEARCH, "Search and toggle matching items" },
}; };
/*
* Allow the user to map incoming characters to various menu commands.
* The accelerator list must be a valid C string.
*/
#define MAX_MENU_MAPPED_CMDS 32 /* some number */
char mapped_menu_cmds[MAX_MENU_MAPPED_CMDS + 1]; /* exported */
static char mapped_menu_op[MAX_MENU_MAPPED_CMDS + 1];
static short n_menu_mapped = 0;
static boolean initial, from_file;
STATIC_DCL void FDECL(nmcpy, (char *, const char *, int)); STATIC_DCL void FDECL(nmcpy, (char *, const char *, int));
STATIC_DCL void FDECL(escapes, (const char *, char *)); STATIC_DCL void FDECL(escapes, (const char *, char *));
STATIC_DCL void FDECL(rejectoption, (const char *)); STATIC_DCL void FDECL(rejectoption, (const char *));
@@ -1059,7 +1047,7 @@ const char *optname;
char *opts; char *opts;
boolean val_optional; boolean val_optional;
{ {
if (!initial) { if (!g.opt_initial) {
rejectoption(optname); rejectoption(optname);
return (char *) 0; return (char *) 0;
} }
@@ -1176,7 +1164,7 @@ const char *optn;
if (fnv == 0L) if (fnv == 0L)
return 0; return 0;
if (fnv > get_current_feature_ver()) { if (fnv > get_current_feature_ver()) {
if (!initial) { if (!g.opt_initial) {
You_cant("disable new feature alerts for future versions."); You_cant("disable new feature alerts for future versions.");
} else { } else {
config_error_add( config_error_add(
@@ -1187,7 +1175,7 @@ const char *optn;
} }
flags.suppress_alert = fnv; flags.suppress_alert = fnv;
if (!initial) { if (!g.opt_initial) {
Sprintf(buf, "%lu.%lu.%lu", FEATURE_NOTICE_VER_MAJ, Sprintf(buf, "%lu.%lu.%lu", FEATURE_NOTICE_VER_MAJ,
FEATURE_NOTICE_VER_MIN, FEATURE_NOTICE_VER_PATCH); FEATURE_NOTICE_VER_MIN, FEATURE_NOTICE_VER_PATCH);
pline( pline(
@@ -1236,7 +1224,7 @@ int iscompound; /* 0 == boolean option, 1 == compound */
{ {
int i, *optptr; int i, *optptr;
if (!iscompound && iflags.opt_booldup && initial && from_file) { if (!iscompound && iflags.opt_booldup && g.opt_initial && g.opt_from_file) {
for (i = 0; boolopt[i].name; i++) { for (i = 0; boolopt[i].name; i++) {
if (match_optname(opts, boolopt[i].name, 3, FALSE)) { if (match_optname(opts, boolopt[i].name, 3, FALSE)) {
optptr = iflags.opt_booldup + i; optptr = iflags.opt_booldup + i;
@@ -1247,7 +1235,7 @@ int iscompound; /* 0 == boolean option, 1 == compound */
return FALSE; return FALSE;
} }
} }
} else if (iscompound && iflags.opt_compdup && initial && from_file) { } else if (iscompound && iflags.opt_compdup && g.opt_initial && g.opt_from_file) {
for (i = 0; compopt[i].name; i++) { for (i = 0; compopt[i].name; i++) {
if (match_optname(opts, compopt[i].name, strlen(compopt[i].name), if (match_optname(opts, compopt[i].name, strlen(compopt[i].name),
TRUE)) { TRUE)) {
@@ -1992,11 +1980,11 @@ boolean tinitial, tfrom_file;
const char *fullname; const char *fullname;
boolean retval = TRUE; boolean retval = TRUE;
initial = tinitial; g.opt_initial = tinitial;
from_file = tfrom_file; g.opt_from_file = tfrom_file;
if ((op = index(opts, ',')) != 0) { if ((op = index(opts, ',')) != 0) {
*op++ = 0; *op++ = 0;
if (!parseoptions(op, initial, from_file)) if (!parseoptions(op, g.opt_initial, g.opt_from_file))
retval = FALSE; retval = FALSE;
} }
if (strlen(opts) > BUFSZ / 2) { if (strlen(opts) > BUFSZ / 2) {
@@ -2035,7 +2023,7 @@ boolean tinitial, tfrom_file;
if (match_optname(opts, "female", 3, FALSE)) { if (match_optname(opts, "female", 3, FALSE)) {
if (duplicate_opt_detection(opts, 0)) if (duplicate_opt_detection(opts, 0))
complain_about_duplicate(opts, 0); complain_about_duplicate(opts, 0);
if (!initial && flags.female == negated) { if (!g.opt_initial && flags.female == negated) {
config_error_add("That is not anatomically possible."); config_error_add("That is not anatomically possible.");
return FALSE; return FALSE;
} else } else
@@ -2046,7 +2034,7 @@ boolean tinitial, tfrom_file;
if (match_optname(opts, "male", 4, FALSE)) { if (match_optname(opts, "male", 4, FALSE)) {
if (duplicate_opt_detection(opts, 0)) if (duplicate_opt_detection(opts, 0))
complain_about_duplicate(opts, 0); complain_about_duplicate(opts, 0);
if (!initial && flags.female != negated) { if (!g.opt_initial && flags.female != negated) {
config_error_add("That is not anatomically possible."); config_error_add("That is not anatomically possible.");
return FALSE; return FALSE;
} else } else
@@ -2217,9 +2205,9 @@ boolean tinitial, tfrom_file;
if (duplicate) if (duplicate)
complain_about_duplicate(opts, 1); complain_about_duplicate(opts, 1);
op = string_for_opt(opts, (compat || !initial)); op = string_for_opt(opts, (compat || !g.opt_initial));
if (!op) { if (!op) {
if (compat || negated || initial) { if (compat || negated || g.opt_initial) {
/* for backwards compatibility, "mouse_support" without a /* for backwards compatibility, "mouse_support" without a
value is a synonym for mouse_support:1 */ value is a synonym for mouse_support:1 */
iflags.wc_mouse_support = !negated; iflags.wc_mouse_support = !negated;
@@ -2246,9 +2234,9 @@ boolean tinitial, tfrom_file;
if (duplicate) if (duplicate)
complain_about_duplicate(opts, 1); complain_about_duplicate(opts, 1);
op = string_for_opt(opts, (compat || !initial)); op = string_for_opt(opts, (compat || !g.opt_initial));
if (!op) { if (!op) {
if (compat || negated || initial) { if (compat || negated || g.opt_initial) {
/* for backwards compatibility, "number_pad" without a /* for backwards compatibility, "number_pad" without a
value is a synonym for number_pad:1 */ value is a synonym for number_pad:1 */
iflags.num_pad = !negated; iflags.num_pad = !negated;
@@ -2299,9 +2287,9 @@ boolean tinitial, tfrom_file;
op, SYMBOLS); op, SYMBOLS);
return FALSE; return FALSE;
} else { } else {
if (!initial && Is_rogue_level(&u.uz)) if (!g.opt_initial && Is_rogue_level(&u.uz))
assign_graphics(ROGUESET); assign_graphics(ROGUESET);
need_redraw = TRUE; g.opt_need_redraw = TRUE;
} }
} else } else
return FALSE; return FALSE;
@@ -2325,7 +2313,7 @@ boolean tinitial, tfrom_file;
return FALSE; return FALSE;
} else { } else {
switch_symbols(g.symset[PRIMARY].name != (char *) 0); switch_symbols(g.symset[PRIMARY].name != (char *) 0);
need_redraw = TRUE; g.opt_need_redraw = TRUE;
} }
} else } else
return FALSE; return FALSE;
@@ -2578,8 +2566,8 @@ boolean tinitial, tfrom_file;
} }
} }
#endif /* !WIN32 */ #endif /* !WIN32 */
if (!initial) { if (!g.opt_initial) {
need_redraw = TRUE; g.opt_need_redraw = TRUE;
} }
return retval; return retval;
} }
@@ -2591,7 +2579,7 @@ boolean tinitial, tfrom_file;
if (duplicate) if (duplicate)
complain_about_duplicate(opts, 1); complain_about_duplicate(opts, 1);
op = string_for_opt(opts, negated || !initial); op = string_for_opt(opts, negated || !g.opt_initial);
if (negated) { if (negated) {
if (op) { if (op) {
bad_negation("fruit", TRUE); bad_negation("fruit", TRUE);
@@ -2604,7 +2592,7 @@ boolean tinitial, tfrom_file;
return FALSE; return FALSE;
/* 3.6.2: strip leading and trailing spaces, condense internal ones */ /* 3.6.2: strip leading and trailing spaces, condense internal ones */
mungspaces(op); mungspaces(op);
if (!initial) { if (!g.opt_initial) {
struct fruit *f; struct fruit *f;
int fnum = 0; int fnum = 0;
@@ -2629,7 +2617,7 @@ boolean tinitial, tfrom_file;
initialization; it gets changed to generic "fruit" */ initialization; it gets changed to generic "fruit" */
if (!*g.pl_fruit) if (!*g.pl_fruit)
nmcpy(g.pl_fruit, "slime mold", PL_FSIZ); nmcpy(g.pl_fruit, "slime mold", PL_FSIZ);
if (!initial) { if (!g.opt_initial) {
/* if 'forig' is nonNull, we replace it rather than add /* if 'forig' is nonNull, we replace it rather than add
a new fruit; it can only be nonNull if no fruits have a new fruit; it can only be nonNull if no fruits have
been created since the previous name was put in place */ been created since the previous name was put in place */
@@ -2744,9 +2732,9 @@ boolean tinitial, tfrom_file;
} }
/* for 'initial', update_bouldersym() is done in initoptions_finish(), /* for 'initial', update_bouldersym() is done in initoptions_finish(),
after all symset options have been processed */ after all symset options have been processed */
if (!initial) { if (!g.opt_initial) {
update_bouldersym(); update_bouldersym();
need_redraw = TRUE; g.opt_need_redraw = TRUE;
} }
return retval; return retval;
#else #else
@@ -2975,9 +2963,9 @@ boolean tinitial, tfrom_file;
complain_about_duplicate(opts, 1); complain_about_duplicate(opts, 1);
oc_to_str(flags.pickup_types, tbuf); oc_to_str(flags.pickup_types, tbuf);
flags.pickup_types[0] = '\0'; /* all */ flags.pickup_types[0] = '\0'; /* all */
op = string_for_opt(opts, (compat || !initial)); op = string_for_opt(opts, (compat || !g.opt_initial));
if (!op) { if (!op) {
if (compat || negated || initial) { if (compat || negated || g.opt_initial) {
/* for backwards compatibility, "pickup" without a /* for backwards compatibility, "pickup" without a
value is a synonym for autopickup of all types value is a synonym for autopickup of all types
(and during initialization, we can't prompt yet) */ (and during initialization, we can't prompt yet) */
@@ -3833,7 +3821,7 @@ boolean tinitial, tfrom_file;
return FALSE; return FALSE;
} else { } else {
switch_symbols(TRUE); switch_symbols(TRUE);
if (!initial && Is_rogue_level(&u.uz)) if (!g.opt_initial && Is_rogue_level(&u.uz))
assign_graphics(ROGUESET); assign_graphics(ROGUESET);
} }
} }
@@ -3867,7 +3855,7 @@ boolean tinitial, tfrom_file;
return FALSE; return FALSE;
} else { } else {
switch_symbols(TRUE); switch_symbols(TRUE);
if (!initial && Is_rogue_level(&u.uz)) if (!g.opt_initial && Is_rogue_level(&u.uz))
assign_graphics(ROGUESET); assign_graphics(ROGUESET);
} }
} }
@@ -3892,13 +3880,13 @@ boolean tinitial, tfrom_file;
if (match_optname(opts, boolopt[i].name, 3, TRUE)) { if (match_optname(opts, boolopt[i].name, 3, TRUE)) {
/* options that don't exist */ /* options that don't exist */
if (!boolopt[i].addr) { if (!boolopt[i].addr) {
if (!initial && !negated) if (!g.opt_initial && !negated)
pline_The("\"%s\" option is not available.", pline_The("\"%s\" option is not available.",
boolopt[i].name); boolopt[i].name);
return retval; return retval;
} }
/* options that must come from config file */ /* options that must come from config file */
if (!initial && (boolopt[i].optflags == SET_IN_FILE)) { if (!g.opt_initial && (boolopt[i].optflags == SET_IN_FILE)) {
rejectoption(boolopt[i].name); rejectoption(boolopt[i].name);
return retval; return retval;
} }
@@ -3947,7 +3935,7 @@ boolean tinitial, tfrom_file;
iflags.wc_ascii_map = negated; iflags.wc_ascii_map = negated;
} }
/* only do processing below if setting with doset() */ /* only do processing below if setting with doset() */
if (initial) if (g.opt_initial)
return retval; return retval;
if (boolopt[i].addr == &flags.time if (boolopt[i].addr == &flags.time
@@ -3974,26 +3962,26 @@ boolean tinitial, tfrom_file;
vision_recalc(2); /* shut down vision */ vision_recalc(2); /* shut down vision */
g.vision_full_recalc = 1; /* delayed recalc */ g.vision_full_recalc = 1; /* delayed recalc */
if (iflags.use_color) if (iflags.use_color)
need_redraw = TRUE; /* darkroom refresh */ g.opt_need_redraw = TRUE; /* darkroom refresh */
} else if (boolopt[i].addr == &flags.showrace } else if (boolopt[i].addr == &flags.showrace
|| boolopt[i].addr == &iflags.use_inverse || boolopt[i].addr == &iflags.use_inverse
|| boolopt[i].addr == &iflags.hilite_pile || boolopt[i].addr == &iflags.hilite_pile
|| boolopt[i].addr == &iflags.hilite_pet || boolopt[i].addr == &iflags.hilite_pet
|| boolopt[i].addr == &iflags.wc_ascii_map || boolopt[i].addr == &iflags.wc_ascii_map
|| boolopt[i].addr == &iflags.wc_tiled_map) { || boolopt[i].addr == &iflags.wc_tiled_map) {
need_redraw = TRUE; g.opt_need_redraw = TRUE;
#ifdef STATUS_HILITES #ifdef STATUS_HILITES
} else if (boolopt[i].addr == &iflags.wc2_hitpointbar) { } else if (boolopt[i].addr == &iflags.wc2_hitpointbar) {
status_initialize(REASSESS_ONLY); status_initialize(REASSESS_ONLY);
need_redraw = TRUE; g.opt_need_redraw = TRUE;
#endif #endif
#ifdef CURSES_GRAPHICS #ifdef CURSES_GRAPHICS
} else if ((boolopt[i].addr) == &iflags.cursesgraphics) { } else if ((boolopt[i].addr) == &iflags.cursesgraphics) {
need_redraw = TRUE; g.opt_need_redraw = TRUE;
#endif #endif
#ifdef TEXTCOLOR #ifdef TEXTCOLOR
} else if (boolopt[i].addr == &iflags.use_color) { } else if (boolopt[i].addr == &iflags.use_color) {
need_redraw = TRUE; g.opt_need_redraw = TRUE;
#ifdef TOS #ifdef TOS
if (iflags.BIOS) { if (iflags.BIOS) {
if (colors_changed) if (colors_changed)
@@ -4113,14 +4101,14 @@ void
add_menu_cmd_alias(from_ch, to_ch) add_menu_cmd_alias(from_ch, to_ch)
char from_ch, to_ch; char from_ch, to_ch;
{ {
if (n_menu_mapped >= MAX_MENU_MAPPED_CMDS) { if (g.n_menu_mapped >= MAX_MENU_MAPPED_CMDS) {
pline("out of menu map space."); pline("out of menu map space.");
} else { } else {
mapped_menu_cmds[n_menu_mapped] = from_ch; g.mapped_menu_cmds[g.n_menu_mapped] = from_ch;
mapped_menu_op[n_menu_mapped] = to_ch; g.mapped_menu_op[g.n_menu_mapped] = to_ch;
n_menu_mapped++; g.n_menu_mapped++;
mapped_menu_cmds[n_menu_mapped] = 0; g.mapped_menu_cmds[g.n_menu_mapped] = 0;
mapped_menu_op[n_menu_mapped] = 0; g.mapped_menu_op[g.n_menu_mapped] = 0;
} }
} }
@@ -4128,12 +4116,12 @@ char
get_menu_cmd_key(ch) get_menu_cmd_key(ch)
char ch; char ch;
{ {
char *found = index(mapped_menu_op, ch); char *found = index(g.mapped_menu_op, ch);
if (found) { if (found) {
int idx = (int) (found - mapped_menu_op); int idx = (int) (found - g.mapped_menu_op);
ch = mapped_menu_cmds[idx]; ch = g.mapped_menu_cmds[idx];
} }
return ch; return ch;
} }
@@ -4146,12 +4134,12 @@ char
map_menu_cmd(ch) map_menu_cmd(ch)
char ch; char ch;
{ {
char *found = index(mapped_menu_cmds, ch); char *found = index(g.mapped_menu_cmds, ch);
if (found) { if (found) {
int idx = (int) (found - mapped_menu_cmds); int idx = (int) (found - g.mapped_menu_cmds);
ch = mapped_menu_op[idx]; ch = g.mapped_menu_op[idx];
} }
return ch; return ch;
} }
@@ -4453,7 +4441,7 @@ doset() /* changing options via menu by Per Liboriussen */
doset_add_menu(tmpwin, fqn_prefix_names[i], 0); doset_add_menu(tmpwin, fqn_prefix_names[i], 0);
#endif #endif
end_menu(tmpwin, "Set what options?"); end_menu(tmpwin, "Set what options?");
need_redraw = FALSE; g.opt_need_redraw = FALSE;
if ((pick_cnt = select_menu(tmpwin, PICK_ANY, &pick_list)) > 0) { if ((pick_cnt = select_menu(tmpwin, PICK_ANY, &pick_list)) > 0) {
/* /*
* Walk down the selection list and either invert the booleans * Walk down the selection list and either invert the booleans
@@ -4514,7 +4502,7 @@ doset() /* changing options via menu by Per Liboriussen */
} }
destroy_nhwindow(tmpwin); destroy_nhwindow(tmpwin);
if (need_redraw) { if (g.opt_need_redraw) {
check_gold_symbol(); check_gold_symbol();
reglyph_darkroom(); reglyph_darkroom();
(void) doredraw(); (void) doredraw();
@@ -5365,7 +5353,7 @@ boolean setinitial, setfromfile;
} else if (!rogueflag) } else if (!rogueflag)
assign_graphics(PRIMARY); assign_graphics(PRIMARY);
preference_update("symset"); preference_update("symset");
need_redraw = TRUE; g.opt_need_redraw = TRUE;
return TRUE; return TRUE;
} else { } else {
+1 -1
View File
@@ -82,7 +82,7 @@ char *outbuf;
/* include race with role unless polymorphed */ /* include race with role unless polymorphed */
race[0] = '\0'; race[0] = '\0';
if (!Upolyd) if (!Upolyd)
Sprintf(race, "%s ", urace.adj); Sprintf(race, "%s ", g.urace.adj);
Sprintf(outbuf, "%s%s%s called %s", Sprintf(outbuf, "%s%s%s called %s",
/* being blinded may hide invisibility from self */ /* being blinded may hide invisibility from self */
(Invis && (senseself() || !Blind)) ? "invisible " : "", race, (Invis && (senseself() || !Blind)) ? "invisible " : "", race,
+21 -21
View File
@@ -250,14 +250,14 @@ change_sex()
if (already_polyd) /* poly'd: also change saved sex */ if (already_polyd) /* poly'd: also change saved sex */
u.mfemale = !u.mfemale; u.mfemale = !u.mfemale;
max_rank_sz(); /* [this appears to be superfluous] */ max_rank_sz(); /* [this appears to be superfluous] */
if ((already_polyd ? u.mfemale : flags.female) && urole.name.f) if ((already_polyd ? u.mfemale : flags.female) && g.urole.name.f)
Strcpy(g.pl_character, urole.name.f); Strcpy(g.pl_character, g.urole.name.f);
else else
Strcpy(g.pl_character, urole.name.m); Strcpy(g.pl_character, g.urole.name.m);
u.umonster = ((already_polyd ? u.mfemale : flags.female) u.umonster = ((already_polyd ? u.mfemale : flags.female)
&& urole.femalenum != NON_PM) && g.urole.femalenum != NON_PM)
? urole.femalenum ? g.urole.femalenum
: urole.malenum; : g.urole.malenum;
if (!already_polyd) { if (!already_polyd) {
u.umonnum = u.umonster; u.umonnum = u.umonster;
} else if (u.umonnum == PM_SUCCUBUS || u.umonnum == PM_INCUBUS) { } else if (u.umonnum == PM_SUCCUBUS || u.umonnum == PM_INCUBUS) {
@@ -369,11 +369,11 @@ newman()
newuhs(FALSE); newuhs(FALSE);
polyman("feel like a new %s!", polyman("feel like a new %s!",
/* use saved gender we're about to revert to, not current */ /* use saved gender we're about to revert to, not current */
((Upolyd ? u.mfemale : flags.female) && urace.individual.f) ((Upolyd ? u.mfemale : flags.female) && g.urace.individual.f)
? urace.individual.f ? g.urace.individual.f
: (urace.individual.m) : (g.urace.individual.m)
? urace.individual.m ? g.urace.individual.m
: urace.noun); : g.urace.noun);
if (Slimed) { if (Slimed) {
Your("body transforms, but there is still slime on you."); Your("body transforms, but there is still slime on you.");
make_slimed(10L, (const char *) 0); make_slimed(10L, (const char *) 0);
@@ -460,8 +460,8 @@ int psflags;
* want if they specified a human.... */ * want if they specified a human.... */
} else if (!polyok(&mons[mntmp]) } else if (!polyok(&mons[mntmp])
&& !(mntmp == PM_HUMAN || your_race(&mons[mntmp]) && !(mntmp == PM_HUMAN || your_race(&mons[mntmp])
|| mntmp == urole.malenum || mntmp == g.urole.malenum
|| mntmp == urole.femalenum)) { || mntmp == g.urole.femalenum)) {
const char *pm_name; const char *pm_name;
/* mkclass_poly() can pick a !polyok() /* mkclass_poly() can pick a !polyok()
@@ -1043,13 +1043,13 @@ rehumanize()
if (emits_light(g.youmonst.data)) if (emits_light(g.youmonst.data))
del_light_source(LS_MONSTER, monst_to_any(&g.youmonst)); del_light_source(LS_MONSTER, monst_to_any(&g.youmonst));
polyman("return to %s form!", urace.adj); polyman("return to %s form!", g.urace.adj);
if (u.uhp < 1) { if (u.uhp < 1) {
/* can only happen if some bit of code reduces u.uhp /* can only happen if some bit of code reduces u.uhp
instead of u.mh while poly'd */ instead of u.mh while poly'd */
Your("old form was not healthy enough to survive."); Your("old form was not healthy enough to survive.");
Sprintf(g.killer.name, "reverting to unhealthy %s form", urace.adj); Sprintf(g.killer.name, "reverting to unhealthy %s form", g.urace.adj);
g.killer.format = KILLED_BY; g.killer.format = KILLED_BY;
done(DIED); done(DIED);
} }
@@ -1839,12 +1839,12 @@ polysense()
boolean boolean
ugenocided() ugenocided()
{ {
return (boolean) ((g.mvitals[urole.malenum].mvflags & G_GENOD) return (boolean) ((g.mvitals[g.urole.malenum].mvflags & G_GENOD)
|| (urole.femalenum != NON_PM || (g.urole.femalenum != NON_PM
&& (g.mvitals[urole.femalenum].mvflags & G_GENOD)) && (g.mvitals[g.urole.femalenum].mvflags & G_GENOD))
|| (g.mvitals[urace.malenum].mvflags & G_GENOD) || (g.mvitals[g.urace.malenum].mvflags & G_GENOD)
|| (urace.femalenum != NON_PM || (g.urace.femalenum != NON_PM
&& (g.mvitals[urace.femalenum].mvflags & G_GENOD))); && (g.mvitals[g.urace.femalenum].mvflags & G_GENOD)));
} }
/* how hero feels "inside" after self-genocide of role or race */ /* how hero feels "inside" after self-genocide of role or race */
+7 -7
View File
@@ -1355,7 +1355,7 @@ dosacrifice()
goto desecrate_high_altar; goto desecrate_high_altar;
} else if (altaralign != A_CHAOTIC && altaralign != A_NONE) { } else if (altaralign != A_CHAOTIC && altaralign != A_NONE) {
/* curse the lawful/neutral altar */ /* curse the lawful/neutral altar */
pline_The("altar is stained with %s blood.", urace.adj); pline_The("altar is stained with %s blood.", g.urace.adj);
levl[u.ux][u.uy].altarmask = AM_CHAOTIC; levl[u.ux][u.uy].altarmask = AM_CHAOTIC;
angry_priest(); angry_priest();
} else { } else {
@@ -2043,13 +2043,13 @@ aligntyp alignment;
gnam = Moloch; gnam = Moloch;
break; break;
case A_LAWFUL: case A_LAWFUL:
gnam = urole.lgod; gnam = g.urole.lgod;
break; break;
case A_NEUTRAL: case A_NEUTRAL:
gnam = urole.ngod; gnam = g.urole.ngod;
break; break;
case A_CHAOTIC: case A_CHAOTIC:
gnam = urole.cgod; gnam = g.urole.cgod;
break; break;
default: default:
impossible("unknown alignment."); impossible("unknown alignment.");
@@ -2137,13 +2137,13 @@ aligntyp alignment;
switch (alignment) { switch (alignment) {
case A_LAWFUL: case A_LAWFUL:
gnam = urole.lgod; gnam = g.urole.lgod;
break; break;
case A_NEUTRAL: case A_NEUTRAL:
gnam = urole.ngod; gnam = g.urole.ngod;
break; break;
case A_CHAOTIC: case A_CHAOTIC:
gnam = urole.cgod; gnam = g.urole.cgod;
break; break;
default: default:
gnam = 0; gnam = 0;
+18 -18
View File
@@ -117,10 +117,10 @@ load_qtlist()
for (i = 0; i < n_classes; i++) { for (i = 0; i < n_classes; i++) {
if (!strncmp(COMMON_ID, qt_classes[i], LEN_HDR)) if (!strncmp(COMMON_ID, qt_classes[i], LEN_HDR))
g.qt_list.common = construct_qtlist(qt_offsets[i]); g.qt_list.common = construct_qtlist(qt_offsets[i]);
else if (!strncmp(urole.filecode, qt_classes[i], LEN_HDR)) else if (!strncmp(g.urole.filecode, qt_classes[i], LEN_HDR))
g.qt_list.chrole = construct_qtlist(qt_offsets[i]); g.qt_list.chrole = construct_qtlist(qt_offsets[i]);
#if 0 /* UNUSED but available */ #if 0 /* UNUSED but available */
else if (!strncmp(urace.filecode, qt_classes[i], LEN_HDR)) else if (!strncmp(g.urace.filecode, qt_classes[i], LEN_HDR))
g.qt_list.chrace = construct_qtlist(qt_offsets[i]); g.qt_list.chrace = construct_qtlist(qt_offsets[i]);
#endif #endif
} }
@@ -150,13 +150,13 @@ int typ;
{ {
switch (typ) { switch (typ) {
case 0: case 0:
return urole.questarti; return g.urole.questarti;
case MS_LEADER: case MS_LEADER:
return urole.ldrnum; return g.urole.ldrnum;
case MS_NEMESIS: case MS_NEMESIS:
return urole.neminum; return g.urole.neminum;
case MS_GUARDIAN: case MS_GUARDIAN:
return urole.guardnum; return g.urole.guardnum;
default: default:
impossible("quest_info(%d)", typ); impossible("quest_info(%d)", typ);
} }
@@ -167,7 +167,7 @@ int typ;
const char * const char *
ldrname() ldrname()
{ {
int i = urole.ldrnum; int i = g.urole.ldrnum;
Sprintf(g.nambuf, "%s%s", type_is_pname(&mons[i]) ? "" : "the ", Sprintf(g.nambuf, "%s%s", type_is_pname(&mons[i]) ? "" : "the ",
mons[i].mname); mons[i].mname);
@@ -178,14 +178,14 @@ ldrname()
STATIC_OVL const char * STATIC_OVL const char *
intermed() intermed()
{ {
return urole.intermed; return g.urole.intermed;
} }
boolean boolean
is_quest_artifact(otmp) is_quest_artifact(otmp)
struct obj *otmp; struct obj *otmp;
{ {
return (boolean) (otmp->oartifact == urole.questarti); return (boolean) (otmp->oartifact == g.urole.questarti);
} }
STATIC_OVL struct obj * STATIC_OVL struct obj *
@@ -244,7 +244,7 @@ unsigned whichchains;
STATIC_OVL const char * STATIC_OVL const char *
neminame() neminame()
{ {
int i = urole.neminum; int i = g.urole.neminum;
Sprintf(g.nambuf, "%s%s", type_is_pname(&mons[i]) ? "" : "the ", Sprintf(g.nambuf, "%s%s", type_is_pname(&mons[i]) ? "" : "the ",
mons[i].mname); mons[i].mname);
@@ -254,7 +254,7 @@ neminame()
STATIC_OVL const char * STATIC_OVL const char *
guardname() /* return your role leader's guard monster name */ guardname() /* return your role leader's guard monster name */
{ {
int i = urole.guardnum; int i = g.urole.guardnum;
return mons[i].mname; return mons[i].mname;
} }
@@ -262,7 +262,7 @@ guardname() /* return your role leader's guard monster name */
STATIC_OVL const char * STATIC_OVL const char *
homebase() /* return your role leader's location */ homebase() /* return your role leader's location */
{ {
return urole.homebase; return g.urole.homebase;
} }
/* replace deity, leader, nemesis, or artifact name with pronoun; /* replace deity, leader, nemesis, or artifact name with pronoun;
@@ -329,7 +329,7 @@ char c;
str = g.plname; str = g.plname;
break; break;
case 'c': case 'c':
str = (flags.female && urole.name.f) ? urole.name.f : urole.name.m; str = (flags.female && g.urole.name.f) ? g.urole.name.f : g.urole.name.m;
break; break;
case 'r': case 'r':
str = rank_of(u.ulevel, Role_switch, flags.female); str = rank_of(u.ulevel, Role_switch, flags.female);
@@ -351,7 +351,7 @@ char c;
break; break;
case 'O': case 'O':
case 'o': case 'o':
str = the(artiname(urole.questarti)); str = the(artiname(g.urole.questarti));
if (c == 'O') { if (c == 'O') {
/* shorten "the Foo of Bar" to "the Foo" /* shorten "the Foo of Bar" to "the Foo"
(buffer returned by the() is modifiable) */ (buffer returned by the() is modifiable) */
@@ -649,15 +649,15 @@ qt_montype()
int qpm; int qpm;
if (rn2(5)) { if (rn2(5)) {
qpm = urole.enemy1num; qpm = g.urole.enemy1num;
if (qpm != NON_PM && rn2(5) && !(g.mvitals[qpm].mvflags & G_GENOD)) if (qpm != NON_PM && rn2(5) && !(g.mvitals[qpm].mvflags & G_GENOD))
return &mons[qpm]; return &mons[qpm];
return mkclass(urole.enemy1sym, 0); return mkclass(g.urole.enemy1sym, 0);
} }
qpm = urole.enemy2num; qpm = g.urole.enemy2num;
if (qpm != NON_PM && rn2(5) && !(g.mvitals[qpm].mvflags & G_GENOD)) if (qpm != NON_PM && rn2(5) && !(g.mvitals[qpm].mvflags & G_GENOD))
return &mons[qpm]; return &mons[qpm];
return mkclass(urole.enemy2sym, 0); return mkclass(g.urole.enemy2sym, 0);
} }
/* special levels can include a custom arrival message; display it */ /* special levels can include a custom arrival message; display it */
+19 -19
View File
@@ -6,11 +6,11 @@
#include "hack.h" #include "hack.h"
#define Your_Own_Role(mndx) \ #define Your_Own_Role(mndx) \
((mndx) == urole.malenum \ ((mndx) == g.urole.malenum \
|| (urole.femalenum != NON_PM && (mndx) == urole.femalenum)) || (g.urole.femalenum != NON_PM && (mndx) == g.urole.femalenum))
#define Your_Own_Race(mndx) \ #define Your_Own_Race(mndx) \
((mndx) == urace.malenum \ ((mndx) == g.urace.malenum \
|| (urace.femalenum != NON_PM && (mndx) == urace.femalenum)) || (g.urace.femalenum != NON_PM && (mndx) == g.urace.femalenum))
static NEARDATA const char readable[] = { ALL_CLASSES, SCROLL_CLASS, static NEARDATA const char readable[] = { ALL_CLASSES, SCROLL_CLASS,
SPBOOK_CLASS, 0 }; SPBOOK_CLASS, 0 };
@@ -2060,8 +2060,8 @@ do_class_genocide()
goodcnt++; goodcnt++;
} }
} }
if (!goodcnt && class != mons[urole.malenum].mlet if (!goodcnt && class != mons[g.urole.malenum].mlet
&& class != mons[urace.malenum].mlet) { && class != mons[g.urace.malenum].mlet) {
if (gonecnt) if (gonecnt)
pline("All such monsters are already nonexistent."); pline("All such monsters are already nonexistent.");
else if (immunecnt || class == S_invisible) else if (immunecnt || class == S_invisible)
@@ -2118,7 +2118,7 @@ do_class_genocide()
/* Self-genocide if it matches either your race /* Self-genocide if it matches either your race
or role. Assumption: male and female forms or role. Assumption: male and female forms
share same monster class. */ share same monster class. */
if (i == urole.malenum || i == urace.malenum) { if (i == g.urole.malenum || i == g.urace.malenum) {
u.uhp = -1; u.uhp = -1;
if (Upolyd) { if (Upolyd) {
if (!feel_dead++) if (!feel_dead++)
@@ -2259,8 +2259,8 @@ int how;
if (Upolyd) if (Upolyd)
Strcpy(buf, g.youmonst.data->mname); Strcpy(buf, g.youmonst.data->mname);
else { else {
Strcpy(buf, (flags.female && urole.name.f) ? urole.name.f Strcpy(buf, (flags.female && g.urole.name.f) ? g.urole.name.f
: urole.name.m); : g.urole.name.m);
buf[0] = lowc(buf[0]); buf[0] = lowc(buf[0]);
} }
} else { } else {
@@ -2276,14 +2276,14 @@ int how;
if (killplayer) { if (killplayer) {
/* might need to wipe out dual role */ /* might need to wipe out dual role */
if (urole.femalenum != NON_PM && mndx == urole.malenum) if (g.urole.femalenum != NON_PM && mndx == g.urole.malenum)
g.mvitals[urole.femalenum].mvflags |= (G_GENOD | G_NOCORPSE); g.mvitals[g.urole.femalenum].mvflags |= (G_GENOD | G_NOCORPSE);
if (urole.femalenum != NON_PM && mndx == urole.femalenum) if (g.urole.femalenum != NON_PM && mndx == g.urole.femalenum)
g.mvitals[urole.malenum].mvflags |= (G_GENOD | G_NOCORPSE); g.mvitals[g.urole.malenum].mvflags |= (G_GENOD | G_NOCORPSE);
if (urace.femalenum != NON_PM && mndx == urace.malenum) if (g.urace.femalenum != NON_PM && mndx == g.urace.malenum)
g.mvitals[urace.femalenum].mvflags |= (G_GENOD | G_NOCORPSE); g.mvitals[g.urace.femalenum].mvflags |= (G_GENOD | G_NOCORPSE);
if (urace.femalenum != NON_PM && mndx == urace.femalenum) if (g.urace.femalenum != NON_PM && mndx == g.urace.femalenum)
g.mvitals[urace.malenum].mvflags |= (G_GENOD | G_NOCORPSE); g.mvitals[g.urace.malenum].mvflags |= (G_GENOD | G_NOCORPSE);
u.uhp = -1; u.uhp = -1;
if (how & PLAYER) { if (how & PLAYER) {
@@ -2440,7 +2440,7 @@ struct _create_particular_data *d;
char *tmpp; char *tmpp;
d->monclass = MAXMCLASSES; d->monclass = MAXMCLASSES;
d->which = urole.malenum; /* an arbitrary index into mons[] */ d->which = g.urole.malenum; /* an arbitrary index into mons[] */
d->fem = -1; /* gender not specified */ d->fem = -1; /* gender not specified */
d->randmonst = FALSE; d->randmonst = FALSE;
d->maketame = d->makepeaceful = d->makehostile = FALSE; d->maketame = d->makepeaceful = d->makehostile = FALSE;
@@ -2492,7 +2492,7 @@ struct _create_particular_data *d;
d->monclass = MAXMCLASSES; /* matters below */ d->monclass = MAXMCLASSES; /* matters below */
return TRUE; return TRUE;
} else if (d->monclass > 0) { } else if (d->monclass > 0) {
d->which = urole.malenum; /* reset from NON_PM */ d->which = g.urole.malenum; /* reset from NON_PM */
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
+198 -202
View File
@@ -11,10 +11,6 @@
* structure eventually. * structure eventually.
*/ */
static NhRegion **regions;
static int n_regions = 0;
static int max_regions = 0;
#define NO_CALLBACK (-1) #define NO_CALLBACK (-1)
boolean FDECL(inside_gas_cloud, (genericptr, genericptr)); boolean FDECL(inside_gas_cloud, (genericptr, genericptr));
@@ -294,19 +290,19 @@ NhRegion *reg;
NhRegion **tmp_reg; NhRegion **tmp_reg;
int i, j; int i, j;
if (max_regions <= n_regions) { if (g.max_regions <= g.n_regions) {
tmp_reg = regions; tmp_reg = g.regions;
regions = g.regions =
(NhRegion **) alloc((max_regions + 10) * sizeof (NhRegion *)); (NhRegion **) alloc((g.max_regions + 10) * sizeof (NhRegion *));
if (max_regions > 0) { if (g.max_regions > 0) {
(void) memcpy((genericptr_t) regions, (genericptr_t) tmp_reg, (void) memcpy((genericptr_t) g.regions, (genericptr_t) tmp_reg,
max_regions * sizeof (NhRegion *)); g.max_regions * sizeof (NhRegion *));
free((genericptr_t) tmp_reg); free((genericptr_t) tmp_reg);
} }
max_regions += 10; g.max_regions += 10;
} }
regions[n_regions] = reg; g.regions[g.n_regions] = reg;
n_regions++; g.n_regions++;
/* Check for monsters inside the region */ /* Check for monsters inside the region */
for (i = reg->bounding_box.lx; i <= reg->bounding_box.hx; i++) for (i = reg->bounding_box.lx; i <= reg->bounding_box.hx; i++)
for (j = reg->bounding_box.ly; j <= reg->bounding_box.hy; j++) { for (j = reg->bounding_box.ly; j <= reg->bounding_box.hy; j++) {
@@ -334,10 +330,10 @@ NhRegion *reg;
{ {
register int i, x, y; register int i, x, y;
for (i = 0; i < n_regions; i++) for (i = 0; i < g.n_regions; i++)
if (regions[i] == reg) if (g.regions[i] == reg)
break; break;
if (i == n_regions) if (i == g.n_regions)
return; return;
/* Update screen if necessary */ /* Update screen if necessary */
@@ -349,9 +345,9 @@ NhRegion *reg;
newsym(x, y); newsym(x, y);
free_region(reg); free_region(reg);
regions[i] = regions[n_regions - 1]; g.regions[i] = g.regions[g.n_regions - 1];
regions[n_regions - 1] = (NhRegion *) 0; g.regions[g.n_regions - 1] = (NhRegion *) 0;
n_regions--; g.n_regions--;
} }
/* /*
@@ -363,13 +359,13 @@ clear_regions()
{ {
register int i; register int i;
for (i = 0; i < n_regions; i++) for (i = 0; i < g.n_regions; i++)
free_region(regions[i]); free_region(g.regions[i]);
n_regions = 0; g.n_regions = 0;
if (max_regions > 0) if (g.max_regions > 0)
free((genericptr_t) regions); free((genericptr_t) g.regions);
max_regions = 0; g.max_regions = 0;
regions = (NhRegion **) 0; g.regions = (NhRegion **) 0;
} }
/* /*
@@ -385,35 +381,35 @@ run_regions()
/* End of life ? */ /* End of life ? */
/* Do it backward because the array will be modified */ /* Do it backward because the array will be modified */
for (i = n_regions - 1; i >= 0; i--) { for (i = g.n_regions - 1; i >= 0; i--) {
if (regions[i]->ttl == 0L) { if (g.regions[i]->ttl == 0L) {
if ((f_indx = regions[i]->expire_f) == NO_CALLBACK if ((f_indx = g.regions[i]->expire_f) == NO_CALLBACK
|| (*callbacks[f_indx])(regions[i], (genericptr_t) 0)) || (*callbacks[f_indx])(g.regions[i], (genericptr_t) 0))
remove_region(regions[i]); remove_region(g.regions[i]);
} }
} }
/* Process remaining regions */ /* Process remaining regions */
for (i = 0; i < n_regions; i++) { for (i = 0; i < g.n_regions; i++) {
/* Make the region age */ /* Make the region age */
if (regions[i]->ttl > 0L) if (g.regions[i]->ttl > 0L)
regions[i]->ttl--; g.regions[i]->ttl--;
/* Check if player is inside region */ /* Check if player is inside region */
f_indx = regions[i]->inside_f; f_indx = g.regions[i]->inside_f;
if (f_indx != NO_CALLBACK && hero_inside(regions[i])) if (f_indx != NO_CALLBACK && hero_inside(g.regions[i]))
(void) (*callbacks[f_indx])(regions[i], (genericptr_t) 0); (void) (*callbacks[f_indx])(g.regions[i], (genericptr_t) 0);
/* Check if any monster is inside region */ /* Check if any monster is inside region */
if (f_indx != NO_CALLBACK) { if (f_indx != NO_CALLBACK) {
for (j = 0; j < regions[i]->n_monst; j++) { for (j = 0; j < g.regions[i]->n_monst; j++) {
struct monst *mtmp = struct monst *mtmp =
find_mid(regions[i]->monsters[j], FM_FMON); find_mid(g.regions[i]->monsters[j], FM_FMON);
if (!mtmp || DEADMONSTER(mtmp) if (!mtmp || DEADMONSTER(mtmp)
|| (*callbacks[f_indx])(regions[i], mtmp)) { || (*callbacks[f_indx])(g.regions[i], mtmp)) {
/* The monster died, remove it from list */ /* The monster died, remove it from list */
k = (regions[i]->n_monst -= 1); k = (g.regions[i]->n_monst -= 1);
regions[i]->monsters[j] = regions[i]->monsters[k]; g.regions[i]->monsters[j] = g.regions[i]->monsters[k];
regions[i]->monsters[k] = 0; g.regions[i]->monsters[k] = 0;
--j; /* current slot has been reused; recheck it next */ --j; /* current slot has been reused; recheck it next */
} }
} }
@@ -431,40 +427,40 @@ xchar x, y;
int i, f_indx; int i, f_indx;
/* First check if we can do the move */ /* First check if we can do the move */
for (i = 0; i < n_regions; i++) { for (i = 0; i < g.n_regions; i++) {
if (inside_region(regions[i], x, y) && !hero_inside(regions[i]) if (inside_region(g.regions[i], x, y) && !hero_inside(g.regions[i])
&& !regions[i]->attach_2_u) { && !g.regions[i]->attach_2_u) {
if ((f_indx = regions[i]->can_enter_f) != NO_CALLBACK) if ((f_indx = g.regions[i]->can_enter_f) != NO_CALLBACK)
if (!(*callbacks[f_indx])(regions[i], (genericptr_t) 0)) if (!(*callbacks[f_indx])(g.regions[i], (genericptr_t) 0))
return FALSE; return FALSE;
} else if (hero_inside(regions[i]) && !inside_region(regions[i], x, y) } else if (hero_inside(g.regions[i]) && !inside_region(g.regions[i], x, y)
&& !regions[i]->attach_2_u) { && !g.regions[i]->attach_2_u) {
if ((f_indx = regions[i]->can_leave_f) != NO_CALLBACK) if ((f_indx = g.regions[i]->can_leave_f) != NO_CALLBACK)
if (!(*callbacks[f_indx])(regions[i], (genericptr_t) 0)) if (!(*callbacks[f_indx])(g.regions[i], (genericptr_t) 0))
return FALSE; return FALSE;
} }
} }
/* Callbacks for the regions we do leave */ /* Callbacks for the regions we do leave */
for (i = 0; i < n_regions; i++) for (i = 0; i < g.n_regions; i++)
if (hero_inside(regions[i]) && !regions[i]->attach_2_u if (hero_inside(g.regions[i]) && !g.regions[i]->attach_2_u
&& !inside_region(regions[i], x, y)) { && !inside_region(g.regions[i], x, y)) {
clear_hero_inside(regions[i]); clear_hero_inside(g.regions[i]);
if (regions[i]->leave_msg != (const char *) 0) if (g.regions[i]->leave_msg != (const char *) 0)
pline1(regions[i]->leave_msg); pline1(g.regions[i]->leave_msg);
if ((f_indx = regions[i]->leave_f) != NO_CALLBACK) if ((f_indx = g.regions[i]->leave_f) != NO_CALLBACK)
(void) (*callbacks[f_indx])(regions[i], (genericptr_t) 0); (void) (*callbacks[f_indx])(g.regions[i], (genericptr_t) 0);
} }
/* Callbacks for the regions we do enter */ /* Callbacks for the regions we do enter */
for (i = 0; i < n_regions; i++) for (i = 0; i < g.n_regions; i++)
if (!hero_inside(regions[i]) && !regions[i]->attach_2_u if (!hero_inside(g.regions[i]) && !g.regions[i]->attach_2_u
&& inside_region(regions[i], x, y)) { && inside_region(g.regions[i], x, y)) {
set_hero_inside(regions[i]); set_hero_inside(g.regions[i]);
if (regions[i]->enter_msg != (const char *) 0) if (g.regions[i]->enter_msg != (const char *) 0)
pline1(regions[i]->enter_msg); pline1(g.regions[i]->enter_msg);
if ((f_indx = regions[i]->enter_f) != NO_CALLBACK) if ((f_indx = g.regions[i]->enter_f) != NO_CALLBACK)
(void) (*callbacks[f_indx])(regions[i], (genericptr_t) 0); (void) (*callbacks[f_indx])(g.regions[i], (genericptr_t) 0);
} }
return TRUE; return TRUE;
} }
@@ -480,38 +476,38 @@ xchar x, y;
int i, f_indx; int i, f_indx;
/* First check if we can do the move */ /* First check if we can do the move */
for (i = 0; i < n_regions; i++) { for (i = 0; i < g.n_regions; i++) {
if (inside_region(regions[i], x, y) && !mon_in_region(regions[i], mon) if (inside_region(g.regions[i], x, y) && !mon_in_region(g.regions[i], mon)
&& regions[i]->attach_2_m != mon->m_id) { && g.regions[i]->attach_2_m != mon->m_id) {
if ((f_indx = regions[i]->can_enter_f) != NO_CALLBACK) if ((f_indx = g.regions[i]->can_enter_f) != NO_CALLBACK)
if (!(*callbacks[f_indx])(regions[i], mon)) if (!(*callbacks[f_indx])(g.regions[i], mon))
return FALSE; return FALSE;
} else if (mon_in_region(regions[i], mon) } else if (mon_in_region(g.regions[i], mon)
&& !inside_region(regions[i], x, y) && !inside_region(g.regions[i], x, y)
&& regions[i]->attach_2_m != mon->m_id) { && g.regions[i]->attach_2_m != mon->m_id) {
if ((f_indx = regions[i]->can_leave_f) != NO_CALLBACK) if ((f_indx = g.regions[i]->can_leave_f) != NO_CALLBACK)
if (!(*callbacks[f_indx])(regions[i], mon)) if (!(*callbacks[f_indx])(g.regions[i], mon))
return FALSE; return FALSE;
} }
} }
/* Callbacks for the regions we do leave */ /* Callbacks for the regions we do leave */
for (i = 0; i < n_regions; i++) for (i = 0; i < g.n_regions; i++)
if (mon_in_region(regions[i], mon) if (mon_in_region(g.regions[i], mon)
&& regions[i]->attach_2_m != mon->m_id && g.regions[i]->attach_2_m != mon->m_id
&& !inside_region(regions[i], x, y)) { && !inside_region(g.regions[i], x, y)) {
remove_mon_from_reg(regions[i], mon); remove_mon_from_reg(g.regions[i], mon);
if ((f_indx = regions[i]->leave_f) != NO_CALLBACK) if ((f_indx = g.regions[i]->leave_f) != NO_CALLBACK)
(void) (*callbacks[f_indx])(regions[i], mon); (void) (*callbacks[f_indx])(g.regions[i], mon);
} }
/* Callbacks for the regions we do enter */ /* Callbacks for the regions we do enter */
for (i = 0; i < n_regions; i++) for (i = 0; i < g.n_regions; i++)
if (!hero_inside(regions[i]) && !regions[i]->attach_2_u if (!hero_inside(g.regions[i]) && !g.regions[i]->attach_2_u
&& inside_region(regions[i], x, y)) { && inside_region(g.regions[i], x, y)) {
add_mon_to_reg(regions[i], mon); add_mon_to_reg(g.regions[i], mon);
if ((f_indx = regions[i]->enter_f) != NO_CALLBACK) if ((f_indx = g.regions[i]->enter_f) != NO_CALLBACK)
(void) (*callbacks[f_indx])(regions[i], mon); (void) (*callbacks[f_indx])(g.regions[i], mon);
} }
return TRUE; return TRUE;
} }
@@ -524,11 +520,11 @@ update_player_regions()
{ {
register int i; register int i;
for (i = 0; i < n_regions; i++) for (i = 0; i < g.n_regions; i++)
if (!regions[i]->attach_2_u && inside_region(regions[i], u.ux, u.uy)) if (!g.regions[i]->attach_2_u && inside_region(g.regions[i], u.ux, u.uy))
set_hero_inside(regions[i]); set_hero_inside(g.regions[i]);
else else
clear_hero_inside(regions[i]); clear_hero_inside(g.regions[i]);
} }
/* /*
@@ -540,13 +536,13 @@ struct monst *mon;
{ {
register int i; register int i;
for (i = 0; i < n_regions; i++) { for (i = 0; i < g.n_regions; i++) {
if (inside_region(regions[i], mon->mx, mon->my)) { if (inside_region(g.regions[i], mon->mx, mon->my)) {
if (!mon_in_region(regions[i], mon)) if (!mon_in_region(g.regions[i], mon))
add_mon_to_reg(regions[i], mon); add_mon_to_reg(g.regions[i], mon);
} else { } else {
if (mon_in_region(regions[i], mon)) if (mon_in_region(g.regions[i], mon))
remove_mon_from_reg(regions[i], mon); remove_mon_from_reg(g.regions[i], mon);
} }
} }
} }
@@ -555,7 +551,7 @@ struct monst *mon;
/* not yet used */ /* not yet used */
/* /*
* Change monster pointer in regions * Change monster pointer in g.regions
* This happens, for instance, when a monster grows and * This happens, for instance, when a monster grows and
* need a new structure (internally that is). * need a new structure (internally that is).
*/ */
@@ -565,10 +561,10 @@ struct monst *monold, *monnew;
{ {
register int i; register int i;
for (i = 0; i < n_regions; i++) for (i = 0; i < g.n_regions; i++)
if (mon_in_region(regions[i], monold)) { if (mon_in_region(g.regions[i], monold)) {
remove_mon_from_reg(regions[i], monold); remove_mon_from_reg(g.regions[i], monold);
add_mon_to_reg(regions[i], monnew); add_mon_to_reg(g.regions[i], monnew);
} }
} }
@@ -581,9 +577,9 @@ struct monst *mon;
{ {
register int i; register int i;
for (i = 0; i < n_regions; i++) for (i = 0; i < g.n_regions; i++)
if (mon_in_region(regions[i], mon)) if (mon_in_region(g.regions[i], mon))
remove_mon_from_reg(regions[i], mon); remove_mon_from_reg(g.regions[i], mon);
} }
#endif /*0*/ #endif /*0*/
@@ -598,10 +594,10 @@ xchar x, y;
{ {
register int i; register int i;
for (i = 0; i < n_regions; i++) for (i = 0; i < g.n_regions; i++)
if (inside_region(regions[i], x, y) && regions[i]->visible if (inside_region(g.regions[i], x, y) && g.regions[i]->visible
&& regions[i]->ttl != -2L) && g.regions[i]->ttl != -2L)
return regions[i]; return g.regions[i];
return (NhRegion *) 0; return (NhRegion *) 0;
} }
@@ -628,43 +624,43 @@ int mode;
goto skip_lots; goto skip_lots;
bwrite(fd, (genericptr_t) &g.moves, sizeof(g.moves)); /* timestamp */ bwrite(fd, (genericptr_t) &g.moves, sizeof(g.moves)); /* timestamp */
bwrite(fd, (genericptr_t) &n_regions, sizeof(n_regions)); bwrite(fd, (genericptr_t) &g.n_regions, sizeof(g.n_regions));
for (i = 0; i < n_regions; i++) { for (i = 0; i < g.n_regions; i++) {
bwrite(fd, (genericptr_t) &regions[i]->bounding_box, sizeof(NhRect)); bwrite(fd, (genericptr_t) &g.regions[i]->bounding_box, sizeof(NhRect));
bwrite(fd, (genericptr_t) &regions[i]->nrects, sizeof(short)); bwrite(fd, (genericptr_t) &g.regions[i]->nrects, sizeof(short));
for (j = 0; j < regions[i]->nrects; j++) for (j = 0; j < g.regions[i]->nrects; j++)
bwrite(fd, (genericptr_t) &regions[i]->rects[j], sizeof(NhRect)); bwrite(fd, (genericptr_t) &g.regions[i]->rects[j], sizeof(NhRect));
bwrite(fd, (genericptr_t) &regions[i]->attach_2_u, sizeof(boolean)); bwrite(fd, (genericptr_t) &g.regions[i]->attach_2_u, sizeof(boolean));
n = 0; n = 0;
bwrite(fd, (genericptr_t) &regions[i]->attach_2_m, sizeof(unsigned)); bwrite(fd, (genericptr_t) &g.regions[i]->attach_2_m, sizeof(unsigned));
n = regions[i]->enter_msg != (const char *) 0 n = g.regions[i]->enter_msg != (const char *) 0
? strlen(regions[i]->enter_msg) ? strlen(g.regions[i]->enter_msg)
: 0; : 0;
bwrite(fd, (genericptr_t) &n, sizeof n); bwrite(fd, (genericptr_t) &n, sizeof n);
if (n > 0) if (n > 0)
bwrite(fd, (genericptr_t) regions[i]->enter_msg, n); bwrite(fd, (genericptr_t) g.regions[i]->enter_msg, n);
n = regions[i]->leave_msg != (const char *) 0 n = g.regions[i]->leave_msg != (const char *) 0
? strlen(regions[i]->leave_msg) ? strlen(g.regions[i]->leave_msg)
: 0; : 0;
bwrite(fd, (genericptr_t) &n, sizeof n); bwrite(fd, (genericptr_t) &n, sizeof n);
if (n > 0) if (n > 0)
bwrite(fd, (genericptr_t) regions[i]->leave_msg, n); bwrite(fd, (genericptr_t) g.regions[i]->leave_msg, n);
bwrite(fd, (genericptr_t) &regions[i]->ttl, sizeof(long)); bwrite(fd, (genericptr_t) &g.regions[i]->ttl, sizeof(long));
bwrite(fd, (genericptr_t) &regions[i]->expire_f, sizeof(short)); bwrite(fd, (genericptr_t) &g.regions[i]->expire_f, sizeof(short));
bwrite(fd, (genericptr_t) &regions[i]->can_enter_f, sizeof(short)); bwrite(fd, (genericptr_t) &g.regions[i]->can_enter_f, sizeof(short));
bwrite(fd, (genericptr_t) &regions[i]->enter_f, sizeof(short)); bwrite(fd, (genericptr_t) &g.regions[i]->enter_f, sizeof(short));
bwrite(fd, (genericptr_t) &regions[i]->can_leave_f, sizeof(short)); bwrite(fd, (genericptr_t) &g.regions[i]->can_leave_f, sizeof(short));
bwrite(fd, (genericptr_t) &regions[i]->leave_f, sizeof(short)); bwrite(fd, (genericptr_t) &g.regions[i]->leave_f, sizeof(short));
bwrite(fd, (genericptr_t) &regions[i]->inside_f, sizeof(short)); bwrite(fd, (genericptr_t) &g.regions[i]->inside_f, sizeof(short));
bwrite(fd, (genericptr_t) &regions[i]->player_flags, bwrite(fd, (genericptr_t) &g.regions[i]->player_flags,
sizeof(unsigned int)); sizeof(unsigned int));
bwrite(fd, (genericptr_t) &regions[i]->n_monst, sizeof(short)); bwrite(fd, (genericptr_t) &g.regions[i]->n_monst, sizeof(short));
for (j = 0; j < regions[i]->n_monst; j++) for (j = 0; j < g.regions[i]->n_monst; j++)
bwrite(fd, (genericptr_t) &regions[i]->monsters[j], bwrite(fd, (genericptr_t) &g.regions[i]->monsters[j],
sizeof(unsigned)); sizeof(unsigned));
bwrite(fd, (genericptr_t) &regions[i]->visible, sizeof(boolean)); bwrite(fd, (genericptr_t) &g.regions[i]->visible, sizeof(boolean));
bwrite(fd, (genericptr_t) &regions[i]->glyph, sizeof(int)); bwrite(fd, (genericptr_t) &g.regions[i]->glyph, sizeof(int));
bwrite(fd, (genericptr_t) &regions[i]->arg, sizeof(anything)); bwrite(fd, (genericptr_t) &g.regions[i]->arg, sizeof(anything));
} }
skip_lots: skip_lots:
@@ -688,79 +684,79 @@ boolean ghostly; /* If a bones file restore */
tmstamp = 0; tmstamp = 0;
else else
tmstamp = (g.moves - tmstamp); tmstamp = (g.moves - tmstamp);
mread(fd, (genericptr_t) &n_regions, sizeof(n_regions)); mread(fd, (genericptr_t) &g.n_regions, sizeof(g.n_regions));
max_regions = n_regions; g.max_regions = g.n_regions;
if (n_regions > 0) if (g.n_regions > 0)
regions = (NhRegion **) alloc(sizeof(NhRegion *) * n_regions); g.regions = (NhRegion **) alloc(sizeof(NhRegion *) * g.n_regions);
for (i = 0; i < n_regions; i++) { for (i = 0; i < g.n_regions; i++) {
regions[i] = (NhRegion *) alloc(sizeof(NhRegion)); g.regions[i] = (NhRegion *) alloc(sizeof(NhRegion));
mread(fd, (genericptr_t) &regions[i]->bounding_box, sizeof(NhRect)); mread(fd, (genericptr_t) &g.regions[i]->bounding_box, sizeof(NhRect));
mread(fd, (genericptr_t) &regions[i]->nrects, sizeof(short)); mread(fd, (genericptr_t) &g.regions[i]->nrects, sizeof(short));
if (regions[i]->nrects > 0) if (g.regions[i]->nrects > 0)
regions[i]->rects = g.regions[i]->rects =
(NhRect *) alloc(sizeof(NhRect) * regions[i]->nrects); (NhRect *) alloc(sizeof(NhRect) * g.regions[i]->nrects);
for (j = 0; j < regions[i]->nrects; j++) for (j = 0; j < g.regions[i]->nrects; j++)
mread(fd, (genericptr_t) &regions[i]->rects[j], sizeof(NhRect)); mread(fd, (genericptr_t) &g.regions[i]->rects[j], sizeof(NhRect));
mread(fd, (genericptr_t) &regions[i]->attach_2_u, sizeof(boolean)); mread(fd, (genericptr_t) &g.regions[i]->attach_2_u, sizeof(boolean));
mread(fd, (genericptr_t) &regions[i]->attach_2_m, sizeof(unsigned)); mread(fd, (genericptr_t) &g.regions[i]->attach_2_m, sizeof(unsigned));
mread(fd, (genericptr_t) &n, sizeof n); mread(fd, (genericptr_t) &n, sizeof n);
if (n > 0) { if (n > 0) {
msg_buf = (char *) alloc(n + 1); msg_buf = (char *) alloc(n + 1);
mread(fd, (genericptr_t) msg_buf, n); mread(fd, (genericptr_t) msg_buf, n);
msg_buf[n] = '\0'; msg_buf[n] = '\0';
regions[i]->enter_msg = (const char *) msg_buf; g.regions[i]->enter_msg = (const char *) msg_buf;
} else } else
regions[i]->enter_msg = (const char *) 0; g.regions[i]->enter_msg = (const char *) 0;
mread(fd, (genericptr_t) &n, sizeof n); mread(fd, (genericptr_t) &n, sizeof n);
if (n > 0) { if (n > 0) {
msg_buf = (char *) alloc(n + 1); msg_buf = (char *) alloc(n + 1);
mread(fd, (genericptr_t) msg_buf, n); mread(fd, (genericptr_t) msg_buf, n);
msg_buf[n] = '\0'; msg_buf[n] = '\0';
regions[i]->leave_msg = (const char *) msg_buf; g.regions[i]->leave_msg = (const char *) msg_buf;
} else } else
regions[i]->leave_msg = (const char *) 0; g.regions[i]->leave_msg = (const char *) 0;
mread(fd, (genericptr_t) &regions[i]->ttl, sizeof(long)); mread(fd, (genericptr_t) &g.regions[i]->ttl, sizeof(long));
/* check for expired region */ /* check for expired region */
if (regions[i]->ttl >= 0L) if (g.regions[i]->ttl >= 0L)
regions[i]->ttl = g.regions[i]->ttl =
(regions[i]->ttl > tmstamp) ? regions[i]->ttl - tmstamp : 0L; (g.regions[i]->ttl > tmstamp) ? g.regions[i]->ttl - tmstamp : 0L;
mread(fd, (genericptr_t) &regions[i]->expire_f, sizeof(short)); mread(fd, (genericptr_t) &g.regions[i]->expire_f, sizeof(short));
mread(fd, (genericptr_t) &regions[i]->can_enter_f, sizeof(short)); mread(fd, (genericptr_t) &g.regions[i]->can_enter_f, sizeof(short));
mread(fd, (genericptr_t) &regions[i]->enter_f, sizeof(short)); mread(fd, (genericptr_t) &g.regions[i]->enter_f, sizeof(short));
mread(fd, (genericptr_t) &regions[i]->can_leave_f, sizeof(short)); mread(fd, (genericptr_t) &g.regions[i]->can_leave_f, sizeof(short));
mread(fd, (genericptr_t) &regions[i]->leave_f, sizeof(short)); mread(fd, (genericptr_t) &g.regions[i]->leave_f, sizeof(short));
mread(fd, (genericptr_t) &regions[i]->inside_f, sizeof(short)); mread(fd, (genericptr_t) &g.regions[i]->inside_f, sizeof(short));
mread(fd, (genericptr_t) &regions[i]->player_flags, mread(fd, (genericptr_t) &g.regions[i]->player_flags,
sizeof(unsigned int)); sizeof(unsigned int));
if (ghostly) { /* settings pertained to old player */ if (ghostly) { /* settings pertained to old player */
clear_hero_inside(regions[i]); clear_hero_inside(g.regions[i]);
clear_heros_fault(regions[i]); clear_heros_fault(g.regions[i]);
} }
mread(fd, (genericptr_t) &regions[i]->n_monst, sizeof(short)); mread(fd, (genericptr_t) &g.regions[i]->n_monst, sizeof(short));
if (regions[i]->n_monst > 0) if (g.regions[i]->n_monst > 0)
regions[i]->monsters = g.regions[i]->monsters =
(unsigned *) alloc(sizeof(unsigned) * regions[i]->n_monst); (unsigned *) alloc(sizeof(unsigned) * g.regions[i]->n_monst);
else else
regions[i]->monsters = (unsigned int *) 0; g.regions[i]->monsters = (unsigned int *) 0;
regions[i]->max_monst = regions[i]->n_monst; g.regions[i]->max_monst = g.regions[i]->n_monst;
for (j = 0; j < regions[i]->n_monst; j++) for (j = 0; j < g.regions[i]->n_monst; j++)
mread(fd, (genericptr_t) &regions[i]->monsters[j], mread(fd, (genericptr_t) &g.regions[i]->monsters[j],
sizeof(unsigned)); sizeof(unsigned));
mread(fd, (genericptr_t) &regions[i]->visible, sizeof(boolean)); mread(fd, (genericptr_t) &g.regions[i]->visible, sizeof(boolean));
mread(fd, (genericptr_t) &regions[i]->glyph, sizeof(int)); mread(fd, (genericptr_t) &g.regions[i]->glyph, sizeof(int));
mread(fd, (genericptr_t) &regions[i]->arg, sizeof(anything)); mread(fd, (genericptr_t) &g.regions[i]->arg, sizeof(anything));
} }
/* remove expired regions, do not trigger the expire_f callback (yet!); /* remove expired regions, do not trigger the expire_f callback (yet!);
also update monster lists if this data is coming from a bones file */ also update monster lists if this data is coming from a bones file */
for (i = n_regions - 1; i >= 0; i--) for (i = g.n_regions - 1; i >= 0; i--)
if (regions[i]->ttl == 0L) if (g.regions[i]->ttl == 0L)
remove_region(regions[i]); remove_region(g.regions[i]);
else if (ghostly && regions[i]->n_monst > 0) else if (ghostly && g.regions[i]->n_monst > 0)
reset_region_mids(regions[i]); reset_region_mids(g.regions[i]);
} }
/* to support '#stats' wizard-mode command */ /* to support '#stats' wizard-mode command */
@@ -775,10 +771,10 @@ long *count, *size;
/* other stats formats take one parameter; this takes two */ /* other stats formats take one parameter; this takes two */
Sprintf(hdrbuf, hdrfmt, (long) sizeof (NhRegion), (long) sizeof (NhRect)); Sprintf(hdrbuf, hdrfmt, (long) sizeof (NhRegion), (long) sizeof (NhRect));
*count = (long) n_regions; /* might be 0 even though max_regions isn't */ *count = (long) g.n_regions; /* might be 0 even though g.max_regions isn't */
*size = (long) max_regions * (long) sizeof (NhRegion); *size = (long) g.max_regions * (long) sizeof (NhRegion);
for (i = 0; i < n_regions; ++i) { for (i = 0; i < g.n_regions; ++i) {
rg = regions[i]; rg = g.regions[i];
*size += (long) rg->nrects * (long) sizeof (NhRect); *size += (long) rg->nrects * (long) sizeof (NhRect);
if (rg->enter_msg) if (rg->enter_msg)
*size += (long) (strlen(rg->enter_msg) + 1); *size += (long) (strlen(rg->enter_msg) + 1);
@@ -1056,11 +1052,11 @@ region_danger()
{ {
int i, f_indx, n = 0; int i, f_indx, n = 0;
for (i = 0; i < n_regions; i++) { for (i = 0; i < g.n_regions; i++) {
/* only care about regions that hero is in */ /* only care about regions that hero is in */
if (!hero_inside(regions[i])) if (!hero_inside(g.regions[i]))
continue; continue;
f_indx = regions[i]->inside_f; f_indx = g.regions[i]->inside_f;
/* the only type of region we understand is gas_cloud */ /* the only type of region we understand is gas_cloud */
if (f_indx == INSIDE_GAS_CLOUD) { if (f_indx == INSIDE_GAS_CLOUD) {
/* completely harmless if you don't need to breathe */ /* completely harmless if you don't need to breathe */
@@ -1084,15 +1080,15 @@ region_safety()
NhRegion *r = 0; NhRegion *r = 0;
int i, f_indx, n = 0; int i, f_indx, n = 0;
for (i = 0; i < n_regions; i++) { for (i = 0; i < g.n_regions; i++) {
/* only care about regions that hero is in */ /* only care about regions that hero is in */
if (!hero_inside(regions[i])) if (!hero_inside(g.regions[i]))
continue; continue;
f_indx = regions[i]->inside_f; f_indx = g.regions[i]->inside_f;
/* the only type of region we understand is gas_cloud */ /* the only type of region we understand is gas_cloud */
if (f_indx == INSIDE_GAS_CLOUD) { if (f_indx == INSIDE_GAS_CLOUD) {
if (!n++ && regions[i]->ttl >= 0) if (!n++ && g.regions[i]->ttl >= 0)
r = regions[i]; r = g.regions[i];
} }
} }
+5 -7
View File
@@ -69,8 +69,6 @@ static const char *rip_txt[] = {
#define DEATH_LINE 8 /* *char[] line # for death description */ #define DEATH_LINE 8 /* *char[] line # for death description */
#define YEAR_LINE 12 /* *char[] line # for year */ #define YEAR_LINE 12 /* *char[] line # for year */
static char **rip;
STATIC_OVL void STATIC_OVL void
center(line, text) center(line, text)
int line; int line;
@@ -78,7 +76,7 @@ char *text;
{ {
register char *ip, *op; register char *ip, *op;
ip = text; ip = text;
op = &rip[line][STONE_LINE_CENT - ((strlen(text) + 1) >> 1)]; op = &g.rip[line][STONE_LINE_CENT - ((strlen(text) + 1) >> 1)];
while (*ip) while (*ip)
*op++ = *ip++; *op++ = *ip++;
} }
@@ -96,7 +94,7 @@ time_t when;
register int x; register int x;
int line; int line;
rip = dp = (char **) alloc(sizeof(rip_txt)); g.rip = dp = (char **) alloc(sizeof(rip_txt));
for (x = 0; rip_txt[x]; ++x) for (x = 0; rip_txt[x]; ++x)
dp[x] = dupstr(rip_txt[x]); dp[x] = dupstr(rip_txt[x]);
dp[x] = (char *) 0; dp[x] = (char *) 0;
@@ -158,10 +156,10 @@ time_t when;
putstr(tmpwin, 0, ""); putstr(tmpwin, 0, "");
for (x = 0; rip_txt[x]; x++) { for (x = 0; rip_txt[x]; x++) {
free((genericptr_t) rip[x]); free((genericptr_t) g.rip[x]);
} }
free((genericptr_t) rip); free((genericptr_t) g.rip);
rip = 0; g.rip = 0;
} }
#endif /* TEXT_TOMBSTONE */ #endif /* TEXT_TOMBSTONE */
+68 -135
View File
@@ -24,7 +24,7 @@
* *
* God names use a leading underscore to flag goddesses. * God names use a leading underscore to flag goddesses.
*/ */
const struct Role roles[] = { const struct Role roles[NUM_ROLES+1] = {
{ { "Archeologist", 0 }, { { "Archeologist", 0 },
{ { "Digger", 0 }, { { "Digger", 0 },
{ "Field Worker", 0 }, { "Field Worker", 0 },
@@ -585,34 +585,6 @@ const struct Role roles[] = {
{ { 0, 0 } } { { 0, 0 } }
}; };
/* The player's role, created at runtime from initial
* choices. This may be munged in role_init().
*/
struct Role urole = {
{ "Undefined", 0 },
{ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } },
"L", "N", "C",
"Xxx", "home", "locate",
NON_PM, NON_PM, NON_PM, NON_PM, NON_PM, NON_PM, NON_PM, NON_PM,
0, 0, 0, 0,
/* Str Int Wis Dex Con Cha */
{ 7, 7, 7, 7, 7, 7 },
{ 20, 15, 15, 20, 20, 10 },
/* Init Lower Higher */
{ 10, 0, 0, 8, 1, 0 }, /* Hit points */
{ 2, 0, 0, 2, 0, 3 },
14, /* Energy */
0,
10,
0,
0,
4,
A_INT,
0,
-3
};
/* Table of all races */ /* Table of all races */
const struct Race races[] = { const struct Race races[] = {
{ {
@@ -725,31 +697,6 @@ const struct Race races[] = {
{ 0, 0, 0, 0 } { 0, 0, 0, 0 }
}; };
/* The player's race, created at runtime from initial
* choices. This may be munged in role_init().
*/
struct Race urace = {
"something",
"undefined",
"something",
"Xxx",
{ 0, 0 },
NON_PM,
NON_PM,
NON_PM,
NON_PM,
0,
0,
0,
0,
/* Str Int Wis Dex Con Cha */
{ 3, 3, 3, 3, 3, 3 },
{ STR18(100), 18, 18, 18, 18, 18 },
/* Init Lower Higher */
{ 2, 0, 0, 2, 1, 0 }, /* Hit points */
{ 1, 0, 2, 0, 2, 0 } /* Energy */
};
/* Table of all genders */ /* Table of all genders */
const struct Gender genders[] = { const struct Gender genders[] = {
{ "male", "he", "him", "his", "Mal", ROLE_MALE }, { "male", "he", "him", "his", "Mal", ROLE_MALE },
@@ -765,12 +712,6 @@ const struct Align aligns[] = {
{ "evil", "unaligned", "Una", 0, A_NONE } { "evil", "unaligned", "Una", 0, A_NONE }
}; };
/* Filters */
static struct {
boolean roles[SIZE(roles)];
short mask;
} rfilter = { UNDEFINED_VALUES, UNDEFINED_VALUE};
STATIC_DCL int NDECL(randrole_filtered); STATIC_DCL int NDECL(randrole_filtered);
STATIC_DCL char *FDECL(promptsep, (char *, int)); STATIC_DCL char *FDECL(promptsep, (char *, int));
STATIC_DCL int FDECL(role_gendercount, (int)); STATIC_DCL int FDECL(role_gendercount, (int));
@@ -1047,7 +988,7 @@ int rolenum, racenum, gendnum, alignnum;
short allow; short allow;
if (rolenum >= 0 && rolenum < SIZE(roles) - 1) { if (rolenum >= 0 && rolenum < SIZE(roles) - 1) {
if (rfilter.roles[rolenum]) if (g.rfilter.roles[rolenum])
return FALSE; return FALSE;
allow = roles[rolenum].allow; allow = roles[rolenum].allow;
if (racenum >= 0 && racenum < SIZE(races) - 1 if (racenum >= 0 && racenum < SIZE(races) - 1
@@ -1063,7 +1004,7 @@ int rolenum, racenum, gendnum, alignnum;
} else { } else {
/* random; check whether any selection is possible */ /* random; check whether any selection is possible */
for (i = 0; i < SIZE(roles) - 1; i++) { for (i = 0; i < SIZE(roles) - 1; i++) {
if (rfilter.roles[i]) if (g.rfilter.roles[i])
continue; continue;
allow = roles[i].allow; allow = roles[i].allow;
if (racenum >= 0 && racenum < SIZE(races) - 1 if (racenum >= 0 && racenum < SIZE(races) - 1
@@ -1115,7 +1056,7 @@ int rolenum, racenum, gendnum, alignnum;
short allow; short allow;
if (racenum >= 0 && racenum < SIZE(races) - 1) { if (racenum >= 0 && racenum < SIZE(races) - 1) {
if (rfilter.mask & races[racenum].selfmask) if (g.rfilter.mask & races[racenum].selfmask)
return FALSE; return FALSE;
allow = races[racenum].allow; allow = races[racenum].allow;
if (rolenum >= 0 && rolenum < SIZE(roles) - 1 if (rolenum >= 0 && rolenum < SIZE(roles) - 1
@@ -1131,7 +1072,7 @@ int rolenum, racenum, gendnum, alignnum;
} else { } else {
/* random; check whether any selection is possible */ /* random; check whether any selection is possible */
for (i = 0; i < SIZE(races) - 1; i++) { for (i = 0; i < SIZE(races) - 1; i++) {
if (rfilter.mask & races[i].selfmask) if (g.rfilter.mask & races[i].selfmask)
continue; continue;
allow = races[i].allow; allow = races[i].allow;
if (rolenum >= 0 && rolenum < SIZE(roles) - 1 if (rolenum >= 0 && rolenum < SIZE(roles) - 1
@@ -1188,7 +1129,7 @@ int alignnum UNUSED;
short allow; short allow;
if (gendnum >= 0 && gendnum < ROLE_GENDERS) { if (gendnum >= 0 && gendnum < ROLE_GENDERS) {
if (rfilter.mask & genders[gendnum].allow) if (g.rfilter.mask & genders[gendnum].allow)
return FALSE; return FALSE;
allow = genders[gendnum].allow; allow = genders[gendnum].allow;
if (rolenum >= 0 && rolenum < SIZE(roles) - 1 if (rolenum >= 0 && rolenum < SIZE(roles) - 1
@@ -1201,7 +1142,7 @@ int alignnum UNUSED;
} else { } else {
/* random; check whether any selection is possible */ /* random; check whether any selection is possible */
for (i = 0; i < ROLE_GENDERS; i++) { for (i = 0; i < ROLE_GENDERS; i++) {
if (rfilter.mask & genders[i].allow) if (g.rfilter.mask & genders[i].allow)
continue; continue;
allow = genders[i].allow; allow = genders[i].allow;
if (rolenum >= 0 && rolenum < SIZE(roles) - 1 if (rolenum >= 0 && rolenum < SIZE(roles) - 1
@@ -1257,7 +1198,7 @@ int alignnum;
short allow; short allow;
if (alignnum >= 0 && alignnum < ROLE_ALIGNS) { if (alignnum >= 0 && alignnum < ROLE_ALIGNS) {
if (rfilter.mask & aligns[alignnum].allow) if (g.rfilter.mask & aligns[alignnum].allow)
return FALSE; return FALSE;
allow = aligns[alignnum].allow; allow = aligns[alignnum].allow;
if (rolenum >= 0 && rolenum < SIZE(roles) - 1 if (rolenum >= 0 && rolenum < SIZE(roles) - 1
@@ -1270,7 +1211,7 @@ int alignnum;
} else { } else {
/* random; check whether any selection is possible */ /* random; check whether any selection is possible */
for (i = 0; i < ROLE_ALIGNS; i++) { for (i = 0; i < ROLE_ALIGNS; i++) {
if (rfilter.mask & aligns[i].allow) if (g.rfilter.mask & aligns[i].allow)
return FALSE; return FALSE;
allow = aligns[i].allow; allow = aligns[i].allow;
if (rolenum >= 0 && rolenum < SIZE(roles) - 1 if (rolenum >= 0 && rolenum < SIZE(roles) - 1
@@ -1371,13 +1312,13 @@ const char *bufp;
boolean reslt = TRUE; boolean reslt = TRUE;
if ((i = str2role(bufp)) != ROLE_NONE && i != ROLE_RANDOM) if ((i = str2role(bufp)) != ROLE_NONE && i != ROLE_RANDOM)
rfilter.roles[i] = TRUE; g.rfilter.roles[i] = TRUE;
else if ((i = str2race(bufp)) != ROLE_NONE && i != ROLE_RANDOM) else if ((i = str2race(bufp)) != ROLE_NONE && i != ROLE_RANDOM)
rfilter.mask |= races[i].selfmask; g.rfilter.mask |= races[i].selfmask;
else if ((i = str2gend(bufp)) != ROLE_NONE && i != ROLE_RANDOM) else if ((i = str2gend(bufp)) != ROLE_NONE && i != ROLE_RANDOM)
rfilter.mask |= genders[i].allow; g.rfilter.mask |= genders[i].allow;
else if ((i = str2align(bufp)) != ROLE_NONE && i != ROLE_RANDOM) else if ((i = str2align(bufp)) != ROLE_NONE && i != ROLE_RANDOM)
rfilter.mask |= aligns[i].allow; g.rfilter.mask |= aligns[i].allow;
else else
reslt = FALSE; reslt = FALSE;
return reslt; return reslt;
@@ -1388,10 +1329,10 @@ gotrolefilter()
{ {
int i; int i;
if (rfilter.mask) if (g.rfilter.mask)
return TRUE; return TRUE;
for (i = 0; i < SIZE(roles); ++i) for (i = 0; i < SIZE(roles); ++i)
if (rfilter.roles[i]) if (g.rfilter.roles[i])
return TRUE; return TRUE;
return FALSE; return FALSE;
} }
@@ -1402,18 +1343,10 @@ clearrolefilter()
int i; int i;
for (i = 0; i < SIZE(roles); ++i) for (i = 0; i < SIZE(roles); ++i)
rfilter.roles[i] = FALSE; g.rfilter.roles[i] = FALSE;
rfilter.mask = 0; g.rfilter.mask = 0;
} }
#define BP_ALIGN 0
#define BP_GEND 1
#define BP_RACE 2
#define BP_ROLE 3
#define NUM_BP 4
STATIC_VAR char pa[NUM_BP], post_attribs;
STATIC_OVL char * STATIC_OVL char *
promptsep(buf, num_post_attribs) promptsep(buf, num_post_attribs)
char *buf; char *buf;
@@ -1421,12 +1354,12 @@ int num_post_attribs;
{ {
const char *conjuct = "and "; const char *conjuct = "and ";
if (num_post_attribs > 1 && post_attribs < num_post_attribs if (num_post_attribs > 1 && g.role_post_attribs < num_post_attribs
&& post_attribs > 1) && g.role_post_attribs > 1)
Strcat(buf, ","); Strcat(buf, ",");
Strcat(buf, " "); Strcat(buf, " ");
--post_attribs; --g.role_post_attribs;
if (!post_attribs && num_post_attribs > 1) if (!g.role_post_attribs && num_post_attribs > 1)
Strcat(buf, conjuct); Strcat(buf, conjuct);
return buf; return buf;
} }
@@ -1480,9 +1413,9 @@ int buflen, rolenum, racenum, gendnum, alignnum;
return err_ret; return err_ret;
/* initialize these static variables each time this is called */ /* initialize these static variables each time this is called */
post_attribs = 0; g.role_post_attribs = 0;
for (k = 0; k < NUM_BP; ++k) for (k = 0; k < NUM_BP; ++k)
pa[k] = 0; g.role_pa[k] = 0;
buf[0] = '\0'; buf[0] = '\0';
*suppliedbuf = '\0'; *suppliedbuf = '\0';
@@ -1515,8 +1448,8 @@ int buflen, rolenum, racenum, gendnum, alignnum;
&& ok_race(rolenum, racenum, gendnum, alignnum)) && ok_race(rolenum, racenum, gendnum, alignnum))
&& (aligncount > 1)) && (aligncount > 1))
|| (racenum == ROLE_NONE || racenum == ROLE_RANDOM)) { || (racenum == ROLE_NONE || racenum == ROLE_RANDOM)) {
pa[BP_ALIGN] = 1; g.role_pa[BP_ALIGN] = 1;
post_attribs++; g.role_post_attribs++;
} }
} }
/* <your lawful> */ /* <your lawful> */
@@ -1548,8 +1481,8 @@ int buflen, rolenum, racenum, gendnum, alignnum;
don't include it in the later list */ don't include it in the later list */
if ((validrole(rolenum) && (gendercount > 1)) if ((validrole(rolenum) && (gendercount > 1))
|| !validrole(rolenum)) { || !validrole(rolenum)) {
pa[BP_GEND] = 1; g.role_pa[BP_GEND] = 1;
post_attribs++; g.role_post_attribs++;
} }
} }
/* <your lawful female> */ /* <your lawful female> */
@@ -1568,12 +1501,12 @@ int buflen, rolenum, racenum, gendnum, alignnum;
Strcat(buf, races[racenum].noun); Strcat(buf, races[racenum].noun);
donefirst = TRUE; donefirst = TRUE;
} else { } else {
pa[BP_RACE] = 1; g.role_pa[BP_RACE] = 1;
post_attribs++; g.role_post_attribs++;
} }
} else { } else {
pa[BP_RACE] = 1; g.role_pa[BP_RACE] = 1;
post_attribs++; g.role_post_attribs++;
} }
/* <your lawful female gnomish> || <your lawful female gnome> */ /* <your lawful female gnomish> || <your lawful female gnome> */
@@ -1595,8 +1528,8 @@ int buflen, rolenum, racenum, gendnum, alignnum;
} }
donefirst = TRUE; donefirst = TRUE;
} else if (rolenum == ROLE_NONE) { } else if (rolenum == ROLE_NONE) {
pa[BP_ROLE] = 1; g.role_pa[BP_ROLE] = 1;
post_attribs++; g.role_post_attribs++;
} }
if ((racenum == ROLE_NONE || racenum == ROLE_RANDOM) if ((racenum == ROLE_NONE || racenum == ROLE_RANDOM)
@@ -1653,34 +1586,34 @@ int buflen, rolenum, racenum, gendnum, alignnum;
* *
* Now append the post attributes to it * Now append the post attributes to it
*/ */
num_post_attribs = post_attribs; num_post_attribs = g.role_post_attribs;
if (!num_post_attribs) { if (!num_post_attribs) {
/* some constraints might have been mutually exclusive, in which case /* some constraints might have been mutually exclusive, in which case
some prompting that would have been omitted is needed after all */ some prompting that would have been omitted is needed after all */
if (flags.initrole == ROLE_NONE && !pa[BP_ROLE]) if (flags.initrole == ROLE_NONE && !g.role_pa[BP_ROLE])
pa[BP_ROLE] = ++post_attribs; g.role_pa[BP_ROLE] = ++g.role_post_attribs;
if (flags.initrace == ROLE_NONE && !pa[BP_RACE]) if (flags.initrace == ROLE_NONE && !g.role_pa[BP_RACE])
pa[BP_RACE] = ++post_attribs; g.role_pa[BP_RACE] = ++g.role_post_attribs;
if (flags.initalign == ROLE_NONE && !pa[BP_ALIGN]) if (flags.initalign == ROLE_NONE && !g.role_pa[BP_ALIGN])
pa[BP_ALIGN] = ++post_attribs; g.role_pa[BP_ALIGN] = ++g.role_post_attribs;
if (flags.initgend == ROLE_NONE && !pa[BP_GEND]) if (flags.initgend == ROLE_NONE && !g.role_pa[BP_GEND])
pa[BP_GEND] = ++post_attribs; g.role_pa[BP_GEND] = ++g.role_post_attribs;
num_post_attribs = post_attribs; num_post_attribs = g.role_post_attribs;
} }
if (num_post_attribs) { if (num_post_attribs) {
if (pa[BP_RACE]) { if (g.role_pa[BP_RACE]) {
(void) promptsep(eos(buf), num_post_attribs); (void) promptsep(eos(buf), num_post_attribs);
Strcat(buf, "race"); Strcat(buf, "race");
} }
if (pa[BP_ROLE]) { if (g.role_pa[BP_ROLE]) {
(void) promptsep(eos(buf), num_post_attribs); (void) promptsep(eos(buf), num_post_attribs);
Strcat(buf, "role"); Strcat(buf, "role");
} }
if (pa[BP_GEND]) { if (g.role_pa[BP_GEND]) {
(void) promptsep(eos(buf), num_post_attribs); (void) promptsep(eos(buf), num_post_attribs);
Strcat(buf, "gender"); Strcat(buf, "gender");
} }
if (pa[BP_ALIGN]) { if (g.role_pa[BP_ALIGN]) {
(void) promptsep(eos(buf), num_post_attribs); (void) promptsep(eos(buf), num_post_attribs);
Strcat(buf, "alignment"); Strcat(buf, "alignment");
} }
@@ -1864,7 +1797,7 @@ boolean preselect;
what = "role"; what = "role";
f = r; f = r;
for (i = 0; i < SIZE(roles); ++i) for (i = 0; i < SIZE(roles); ++i)
if (i != f && !rfilter.roles[i]) if (i != f && !g.rfilter.roles[i])
break; break;
if (i == SIZE(roles)) { if (i == SIZE(roles)) {
constrainer = "filter"; constrainer = "filter";
@@ -1883,7 +1816,7 @@ boolean preselect;
constrainer = "role"; constrainer = "role";
forcedvalue = races[c].noun; forcedvalue = races[c].noun;
} else if (f >= 0 } else if (f >= 0
&& (allowmask & ~rfilter.mask) == races[f].selfmask) { && (allowmask & ~g.rfilter.mask) == races[f].selfmask) {
/* if there is only one race choice available due to user /* if there is only one race choice available due to user
options disallowing others, race menu entry is disabled */ options disallowing others, race menu entry is disabled */
constrainer = "filter"; constrainer = "filter";
@@ -1905,7 +1838,7 @@ boolean preselect;
constrainer = "role"; constrainer = "role";
forcedvalue = genders[gend].adj; forcedvalue = genders[gend].adj;
} else if (f >= 0 } else if (f >= 0
&& (allowmask & ~rfilter.mask) == genders[f].allow) { && (allowmask & ~g.rfilter.mask) == genders[f].allow) {
/* if there is only one gender choice available due to user /* if there is only one gender choice available due to user
options disallowing other, gender menu entry is disabled */ options disallowing other, gender menu entry is disabled */
constrainer = "filter"; constrainer = "filter";
@@ -1940,7 +1873,7 @@ boolean preselect;
constrainer = "race"; constrainer = "race";
} }
if (f >= 0 && !constrainer if (f >= 0 && !constrainer
&& (ROLE_ALIGNMASK & ~rfilter.mask) == aligns[f].allow) { && (ROLE_ALIGNMASK & ~g.rfilter.mask) == aligns[f].allow) {
/* if there is only one alignment choice available due to user /* if there is only one alignment choice available due to user
options disallowing others, algn menu entry is disabled */ options disallowing others, algn menu entry is disabled */
constrainer = "filter"; constrainer = "filter";
@@ -2041,13 +1974,13 @@ role_init()
flags.initalign = randalign(flags.initrole, flags.initrace); flags.initalign = randalign(flags.initrole, flags.initrace);
alignmnt = aligns[flags.initalign].value; alignmnt = aligns[flags.initalign].value;
/* Initialize urole and urace */ /* Initialize g.urole and g.urace */
urole = roles[flags.initrole]; g.urole = roles[flags.initrole];
urace = races[flags.initrace]; g.urace = races[flags.initrace];
/* Fix up the quest leader */ /* Fix up the quest leader */
if (urole.ldrnum != NON_PM) { if (g.urole.ldrnum != NON_PM) {
pm = &mons[urole.ldrnum]; pm = &mons[g.urole.ldrnum];
pm->msound = MS_LEADER; pm->msound = MS_LEADER;
pm->mflags2 |= (M2_PEACEFUL); pm->mflags2 |= (M2_PEACEFUL);
pm->mflags3 |= M3_CLOSE; pm->mflags3 |= M3_CLOSE;
@@ -2061,15 +1994,15 @@ role_init()
} }
/* Fix up the quest guardians */ /* Fix up the quest guardians */
if (urole.guardnum != NON_PM) { if (g.urole.guardnum != NON_PM) {
pm = &mons[urole.guardnum]; pm = &mons[g.urole.guardnum];
pm->mflags2 |= (M2_PEACEFUL); pm->mflags2 |= (M2_PEACEFUL);
pm->maligntyp = alignmnt * 3; pm->maligntyp = alignmnt * 3;
} }
/* Fix up the quest nemesis */ /* Fix up the quest nemesis */
if (urole.neminum != NON_PM) { if (g.urole.neminum != NON_PM) {
pm = &mons[urole.neminum]; pm = &mons[g.urole.neminum];
pm->msound = MS_NEMESIS; pm->msound = MS_NEMESIS;
pm->mflags2 &= ~(M2_PEACEFUL); pm->mflags2 &= ~(M2_PEACEFUL);
pm->mflags2 |= (M2_NASTY | M2_STALK | M2_HOSTILE); pm->mflags2 |= (M2_NASTY | M2_STALK | M2_HOSTILE);
@@ -2087,16 +2020,16 @@ role_init()
while (!roles[flags.pantheon].lgod) /* unless they're missing */ while (!roles[flags.pantheon].lgod) /* unless they're missing */
flags.pantheon = randrole(); flags.pantheon = randrole();
} }
if (!urole.lgod) { if (!g.urole.lgod) {
urole.lgod = roles[flags.pantheon].lgod; g.urole.lgod = roles[flags.pantheon].lgod;
urole.ngod = roles[flags.pantheon].ngod; g.urole.ngod = roles[flags.pantheon].ngod;
urole.cgod = roles[flags.pantheon].cgod; g.urole.cgod = roles[flags.pantheon].cgod;
} }
/* 0 or 1; no gods are neuter, nor is gender randomized */ /* 0 or 1; no gods are neuter, nor is gender randomized */
g.quest_status.godgend = !strcmpi(align_gtitle(alignmnt), "goddess"); g.quest_status.godgend = !strcmpi(align_gtitle(alignmnt), "goddess");
/* Fix up infravision */ /* Fix up infravision */
if (mons[urace.malenum].mflags3 & M3_INFRAVISION) { if (mons[g.urace.malenum].mflags3 & M3_INFRAVISION) {
/* although an infravision intrinsic is possible, infravision /* although an infravision intrinsic is possible, infravision
* is purely a property of the physical race. This means that we * is purely a property of the physical race. This means that we
* must put the infravision flag in the player's current race * must put the infravision flag in the player's current race
@@ -2106,9 +2039,9 @@ role_init()
* but since infravision has no effect for NPCs anyway we can * but since infravision has no effect for NPCs anyway we can
* ignore this. * ignore this.
*/ */
mons[urole.malenum].mflags3 |= M3_INFRAVISION; mons[g.urole.malenum].mflags3 |= M3_INFRAVISION;
if (urole.femalenum != NON_PM) if (g.urole.femalenum != NON_PM)
mons[urole.femalenum].mflags3 |= M3_INFRAVISION; mons[g.urole.femalenum].mflags3 |= M3_INFRAVISION;
} }
/* Artifacts are fixed in hack_artifacts() */ /* Artifacts are fixed in hack_artifacts() */
+2 -3
View File
@@ -25,7 +25,6 @@ STATIC_DCL void FDECL(kops_gone, (BOOLEAN_P));
extern const struct shclass shtypes[]; /* defined in shknam.c */ extern const struct shclass shtypes[]; /* defined in shknam.c */
STATIC_VAR NEARDATA long int followmsg; /* last time of follow message */
STATIC_VAR const char and_its_contents[] = " and its contents"; STATIC_VAR const char and_its_contents[] = " and its contents";
STATIC_VAR const char the_contents_of[] = "the contents of "; STATIC_VAR const char the_contents_of[] = "the contents of ";
@@ -3690,7 +3689,7 @@ struct monst *shkp;
eshkp->following = 0; eshkp->following = 0;
return 0; return 0;
} }
if (g.moves > followmsg + 4) { if (g.moves > g.followmsg + 4) {
if (!Deaf && !muteshk(shkp)) if (!Deaf && !muteshk(shkp))
verbalize("%s, %s! Didn't you forget to pay?", verbalize("%s, %s! Didn't you forget to pay?",
Hello(shkp), g.plname); Hello(shkp), g.plname);
@@ -3698,7 +3697,7 @@ struct monst *shkp;
pline("%s holds out %s upturned %s.", pline("%s holds out %s upturned %s.",
Shknam(shkp), noit_mhis(shkp), Shknam(shkp), noit_mhis(shkp),
mbodypart(shkp, HAND)); mbodypart(shkp, HAND));
followmsg = g.moves; g.followmsg = g.moves;
if (!rn2(9)) { if (!rn2(9)) {
pline("%s doesn't like customers who don't pay.", pline("%s doesn't like customers who don't pay.",
Shknam(shkp)); Shknam(shkp));
+4 -4
View File
@@ -508,7 +508,7 @@ register struct monst *mtmp;
if (mtmp->m_id == g.quest_status.leader_m_id && msound > MS_ANIMAL) if (mtmp->m_id == g.quest_status.leader_m_id && msound > MS_ANIMAL)
msound = MS_LEADER; msound = MS_LEADER;
/* make sure it's your role's quest guardian; adjust if not */ /* make sure it's your role's quest guardian; adjust if not */
else if (msound == MS_GUARDIAN && ptr != &mons[urole.guardnum]) else if (msound == MS_GUARDIAN && ptr != &mons[g.urole.guardnum])
msound = mons[genus(monsndx(ptr), 1)].msound; msound = mons[genus(monsndx(ptr), 1)].msound;
/* some normally non-speaking types can/will speak if hero is similar */ /* some normally non-speaking types can/will speak if hero is similar */
else if (msound == MS_ORC /* note: MS_ORC is same as MS_GRUNT */ else if (msound == MS_ORC /* note: MS_ORC is same as MS_GRUNT */
@@ -557,9 +557,9 @@ register struct monst *mtmp;
(Upolyd && (u.umonnum == PM_WOLF || u.umonnum == PM_WINTER_WOLF (Upolyd && (u.umonnum == PM_WOLF || u.umonnum == PM_WINTER_WOLF
|| u.umonnum == PM_WINTER_WOLF_CUB)); || u.umonnum == PM_WINTER_WOLF_CUB));
const char *racenoun = const char *racenoun =
(flags.female && urace.individual.f) (flags.female && g.urace.individual.f)
? urace.individual.f ? g.urace.individual.f
: (urace.individual.m) ? urace.individual.m : urace.noun; : (g.urace.individual.m) ? g.urace.individual.m : g.urace.noun;
if (mtmp->mtame) { if (mtmp->mtame) {
if (kindred) { if (kindred) {
+10 -10
View File
@@ -1660,17 +1660,17 @@ int spell;
/* Calculate intrinsic ability (splcaster) */ /* Calculate intrinsic ability (splcaster) */
splcaster = urole.spelbase; splcaster = g.urole.spelbase;
special = urole.spelheal; special = g.urole.spelheal;
statused = ACURR(urole.spelstat); statused = ACURR(g.urole.spelstat);
if (uarm && is_metallic(uarm)) if (uarm && is_metallic(uarm))
splcaster += (uarmc && uarmc->otyp == ROBE) ? urole.spelarmr / 2 splcaster += (uarmc && uarmc->otyp == ROBE) ? g.urole.spelarmr / 2
: urole.spelarmr; : g.urole.spelarmr;
else if (uarmc && uarmc->otyp == ROBE) else if (uarmc && uarmc->otyp == ROBE)
splcaster -= urole.spelarmr; splcaster -= g.urole.spelarmr;
if (uarms) if (uarms)
splcaster += urole.spelshld; splcaster += g.urole.spelshld;
if (uarmh && is_metallic(uarmh) && uarmh->otyp != HELM_OF_BRILLIANCE) if (uarmh && is_metallic(uarmh) && uarmh->otyp != HELM_OF_BRILLIANCE)
splcaster += uarmhbon; splcaster += uarmhbon;
@@ -1679,8 +1679,8 @@ int spell;
if (uarmf && is_metallic(uarmf)) if (uarmf && is_metallic(uarmf))
splcaster += uarmfbon; splcaster += uarmfbon;
if (spellid(spell) == urole.spelspec) if (spellid(spell) == g.urole.spelspec)
splcaster += urole.spelsbon; splcaster += g.urole.spelsbon;
/* `healing spell' bonus */ /* `healing spell' bonus */
if (spellid(spell) == SPE_HEALING || spellid(spell) == SPE_EXTRA_HEALING if (spellid(spell) == SPE_HEALING || spellid(spell) == SPE_EXTRA_HEALING
@@ -1738,7 +1738,7 @@ int spell;
* player's role-specific spell. * player's role-specific spell.
*/ */
if (uarms && weight(uarms) > (int) objects[SMALL_SHIELD].oc_weight) { if (uarms && weight(uarms) > (int) objects[SMALL_SHIELD].oc_weight) {
if (spellid(spell) == urole.spelspec) { if (spellid(spell) == g.urole.spelspec) {
chance /= 2; chance /= 2;
} else { } else {
chance /= 4; chance /= 4;
+3 -7
View File
@@ -20,10 +20,6 @@ struct sysopt sysopt;
void void
sys_early_init() sys_early_init()
{ {
decl_globals_init();
objects_globals_init();
monst_globals_init();
sysopt.support = (char *) 0; sysopt.support = (char *) 0;
sysopt.recover = (char *) 0; sysopt.recover = (char *) 0;
#ifdef SYSCF #ifdef SYSCF
@@ -124,14 +120,14 @@ sysopt_release()
return; return;
} }
extern struct attack sa_yes[NATTK]; extern const struct attack c_sa_yes[NATTK];
extern struct attack sa_no[NATTK]; extern const struct attack c_sa_no[NATTK];
void void
sysopt_seduce_set(val) sysopt_seduce_set(val)
int val; int val;
{ {
struct attack *setval = val ? sa_yes : sa_no; const struct attack *setval = val ? c_sa_yes : c_sa_no;
int x; int x;
for (x = 0; x < NATTK; x++) { for (x = 0; x < NATTK; x++) {
+7 -10
View File
@@ -11,9 +11,6 @@ STATIC_DCL void NDECL(vault_tele);
STATIC_DCL boolean FDECL(rloc_pos_ok, (int, int, struct monst *)); STATIC_DCL boolean FDECL(rloc_pos_ok, (int, int, struct monst *));
STATIC_DCL void FDECL(mvault_tele, (struct monst *)); STATIC_DCL void FDECL(mvault_tele, (struct monst *));
/* non-null when teleporting via having read this scroll */
STATIC_VAR struct obj *telescroll = 0;
/* /*
* Is (x,y) a good position of mtmp? If mtmp is NULL, then is (x,y) good * Is (x,y) a good position of mtmp? If mtmp is NULL, then is (x,y) good
* for an object? * for an object?
@@ -345,14 +342,14 @@ boolean allow_drag;
been updated for new location instead of right after u_on_newpos() */ been updated for new location instead of right after u_on_newpos() */
if (levl[u.ux][u.uy].typ != levl[u.ux0][u.uy0].typ) if (levl[u.ux][u.uy].typ != levl[u.ux0][u.uy0].typ)
switch_terrain(); switch_terrain();
if (telescroll) { if (g.telescroll) {
/* when teleporting by scroll, we need to handle discovery /* when teleporting by scroll, we need to handle discovery
now before getting feedback about any objects at our now before getting feedback about any objects at our
destination since we might land on another such scroll */ destination since we might land on another such scroll */
if (distu(u.ux0, u.uy0) >= 16 || !couldsee(u.ux0, u.uy0)) if (distu(u.ux0, u.uy0) >= 16 || !couldsee(u.ux0, u.uy0))
learnscroll(telescroll); learnscroll(g.telescroll);
else else
telescroll = 0; /* no discovery by scrolltele()'s caller */ g.telescroll = 0; /* no discovery by scrolltele()'s caller */
} }
spoteffects(TRUE); spoteffects(TRUE);
invocation_message(); invocation_message();
@@ -486,13 +483,13 @@ struct obj *scroll;
result = TRUE; result = TRUE;
} }
telescroll = scroll; g.telescroll = scroll;
(void) safe_teleds(FALSE); (void) safe_teleds(FALSE);
/* teleds() will leave telescroll intact iff random destination /* teleds() will leave g.telescroll intact iff random destination
is far enough away for scroll discovery to be warranted */ is far enough away for scroll discovery to be warranted */
if (telescroll) if (g.telescroll)
result = TRUE; result = TRUE;
telescroll = 0; /* reset */ g.telescroll = 0; /* reset */
return result; return result;
} }
+4 -7
View File
@@ -23,9 +23,6 @@
* way to truncate it). The trailing junk is harmless and the code * way to truncate it). The trailing junk is harmless and the code
* which reads the scores will ignore it. * which reads the scores will ignore it.
*/ */
#ifdef UPDATE_RECORD_IN_PLACE
static long final_fpos;
#endif
#define done_stopprint g.program_state.stopprint #define done_stopprint g.program_state.stopprint
@@ -232,7 +229,7 @@ struct toptenentry *tt;
#ifdef UPDATE_RECORD_IN_PLACE #ifdef UPDATE_RECORD_IN_PLACE
/* note: input below must read the record's terminating newline */ /* note: input below must read the record's terminating newline */
final_fpos = tt->fpos = ftell(rfile); g.final_fpos = tt->fpos = ftell(rfile);
#endif #endif
#define TTFIELDS 13 #define TTFIELDS 13
if (fscanf(rfile, fmt, &tt->ver_major, &tt->ver_minor, &tt->patchlevel, if (fscanf(rfile, fmt, &tt->ver_major, &tt->ver_minor, &tt->patchlevel,
@@ -547,8 +544,8 @@ time_t when;
t0->maxhp = u.uhpmax; t0->maxhp = u.uhpmax;
t0->deaths = u.umortality; t0->deaths = u.umortality;
t0->uid = uid; t0->uid = uid;
copynchars(t0->plrole, urole.filecode, ROLESZ); copynchars(t0->plrole, g.urole.filecode, ROLESZ);
copynchars(t0->plrace, urace.filecode, ROLESZ); copynchars(t0->plrace, g.urace.filecode, ROLESZ);
copynchars(t0->plgend, genders[flags.female].filecode, ROLESZ); copynchars(t0->plgend, genders[flags.female].filecode, ROLESZ);
copynchars(t0->plalign, aligns[1 - u.ualign.type].filecode, ROLESZ); copynchars(t0->plalign, aligns[1 - u.ualign.type].filecode, ROLESZ);
copynchars(t0->name, g.plname, NAMSZ); copynchars(t0->name, g.plname, NAMSZ);
@@ -676,7 +673,7 @@ time_t when;
} }
if (flg) { /* rewrite record file */ if (flg) { /* rewrite record file */
#ifdef UPDATE_RECORD_IN_PLACE #ifdef UPDATE_RECORD_IN_PLACE
(void) fseek(rfile, (t0->fpos >= 0 ? t0->fpos : final_fpos), (void) fseek(rfile, (t0->fpos >= 0 ? t0->fpos : g.final_fpos),
SEEK_SET); SEEK_SET);
#else #else
(void) fclose(rfile); (void) fclose(rfile);
+5 -5
View File
@@ -625,9 +625,9 @@ u_init()
u.umortality = 0; u.umortality = 0;
u.ugrave_arise = NON_PM; u.ugrave_arise = NON_PM;
u.umonnum = u.umonster = (flags.female && urole.femalenum != NON_PM) u.umonnum = u.umonster = (flags.female && g.urole.femalenum != NON_PM)
? urole.femalenum ? g.urole.femalenum
: urole.malenum; : g.urole.malenum;
u.ulycn = NON_PM; u.ulycn = NON_PM;
set_uasmon(); set_uasmon();
@@ -1047,13 +1047,13 @@ register struct trobj *trop;
g.nocreate4 = otyp; g.nocreate4 = otyp;
} }
if (urace.malenum != PM_HUMAN) { if (g.urace.malenum != PM_HUMAN) {
/* substitute race-specific items; this used to be in /* substitute race-specific items; this used to be in
the 'if (otyp != UNDEF_TYP) { }' block above, but then the 'if (otyp != UNDEF_TYP) { }' block above, but then
substitutions didn't occur for randomly generated items substitutions didn't occur for randomly generated items
(particularly food) which have racial substitutes */ (particularly food) which have racial substitutes */
for (i = 0; inv_subs[i].race_pm != NON_PM; ++i) for (i = 0; inv_subs[i].race_pm != NON_PM; ++i)
if (inv_subs[i].race_pm == urace.malenum if (inv_subs[i].race_pm == g.urace.malenum
&& otyp == inv_subs[i].item_otyp) { && otyp == inv_subs[i].item_otyp) {
debugpline3("ini_inv: substituting %s for %s%s", debugpline3("ini_inv: substituting %s for %s%s",
OBJ_NAME(objects[inv_subs[i].subs_otyp]), OBJ_NAME(objects[inv_subs[i].subs_otyp]),
+1 -1
View File
@@ -288,7 +288,7 @@ int *attk_count, *role_roll_penalty;
/* role/race adjustments */ /* role/race adjustments */
if (Role_if(PM_MONK) && !Upolyd) { if (Role_if(PM_MONK) && !Upolyd) {
if (uarm) if (uarm)
tmp -= (*role_roll_penalty = urole.spelarmr); tmp -= (*role_roll_penalty = g.urole.spelarmr);
else if (!uwep && !uarms) else if (!uwep && !uarms)
tmp += (u.ulevel / 3) + 2; tmp += (u.ulevel / 3) + 2;
} }
+13 -12
View File
@@ -23,7 +23,7 @@
* @...X +4 * @...X +4
* *
*/ */
char circle_data[] = { const char circle_data[] = {
/* 0*/ 1, 1, /* 0*/ 1, 1,
/* 2*/ 2, 2, 1, /* 2*/ 2, 2, 1,
/* 5*/ 3, 3, 2, 1, /* 5*/ 3, 3, 2, 1,
@@ -46,7 +46,7 @@ char circle_data[] = {
* These are the starting indexes into the circle_data[] array for a * These are the starting indexes into the circle_data[] array for a
* circle of a given radius. * circle of a given radius.
*/ */
char circle_start[] = { const char circle_start[] = {
/* */ 0, /* circles of radius zero are not used */ /* */ 0, /* circles of radius zero are not used */
/* 1*/ 0, /* 1*/ 0,
/* 2*/ 2, /* 2*/ 2,
@@ -496,7 +496,7 @@ int control;
char *old_row; /* row pointer for the old array */ char *old_row; /* row pointer for the old array */
char *next_rmin; /* min pointer for the new array */ char *next_rmin; /* min pointer for the new array */
char *next_rmax; /* max pointer for the new array */ char *next_rmax; /* max pointer for the new array */
char *ranges; /* circle ranges -- used for xray & night vision */ const char *ranges; /* circle ranges -- used for xray & night vision */
int row = 0; /* row counter (outer loop) */ int row = 0; /* row counter (outer loop) */
int start, stop; /* inner loop starting/stopping index */ int start, stop; /* inner loop starting/stopping index */
int dx, dy; /* one step from a lit door or lit wall (see below) */ int dx, dy; /* one step from a lit door or lit wall (see below) */
@@ -1602,8 +1602,9 @@ static close2d *close_dy[CLOSE_MAX_BC_DY];
static far2d *far_dy[FAR_MAX_BC_DY]; static far2d *far_dy[FAR_MAX_BC_DY];
STATIC_DCL void FDECL(right_side, (int, int, int, int, int, STATIC_DCL void FDECL(right_side, (int, int, int, int, int,
int, int, char *)); int, int, const char *));
STATIC_DCL void FDECL(left_side, (int, int, int, int, int, int, int, char *)); STATIC_DCL void FDECL(left_side, (int, int, int, int, int, int, int,
const char *));
STATIC_DCL int FDECL(close_shadow, (int, int, int, int)); STATIC_DCL int FDECL(close_shadow, (int, int, int, int));
STATIC_DCL int FDECL(far_shadow, (int, int, int, int)); STATIC_DCL int FDECL(far_shadow, (int, int, int, int));
@@ -1994,7 +1995,7 @@ int cb_row, cb_col; /* close block row and col */
int fb_row, fb_col; /* far block row and col */ int fb_row, fb_col; /* far block row and col */
int left_mark; /* left mark of previous row */ int left_mark; /* left mark of previous row */
int right; /* right mark of the previous row */ int right; /* right mark of the previous row */
char *limits; const char *limits;
{ {
register int i; register int i;
register char *rowp = NULL; register char *rowp = NULL;
@@ -2285,8 +2286,8 @@ genericptr_t arg;
/* /*
* Defines local to Algorithm C. * Defines local to Algorithm C.
*/ */
STATIC_DCL void FDECL(right_side, (int, int, int, char *)); STATIC_DCL void FDECL(right_side, (int, int, int, const char *));
STATIC_DCL void FDECL(left_side, (int, int, int, char *)); STATIC_DCL void FDECL(left_side, (int, int, int, const char *));
/* Initialize algorithm C (nothing). */ /* Initialize algorithm C (nothing). */
STATIC_OVL void STATIC_OVL void
@@ -2303,7 +2304,7 @@ right_side(row, left, right_mark, limits)
int row; /* current row */ int row; /* current row */
int left; /* first (left side) visible spot on prev row */ int left; /* first (left side) visible spot on prev row */
int right_mark; /* last (right side) visible spot on prev row */ int right_mark; /* last (right side) visible spot on prev row */
char *limits; /* points at range limit for current row, or NULL */ const char *limits; /* points at range limit for current row, or NULL */
{ {
int right; /* right limit of "could see" */ int right; /* right limit of "could see" */
int right_edge; /* right edge of an opening */ int right_edge; /* right edge of an opening */
@@ -2493,7 +2494,7 @@ char *limits; /* points at range limit for current row, or NULL */
STATIC_OVL void STATIC_OVL void
left_side(row, left_mark, right, limits) left_side(row, left_mark, right, limits)
int row, left_mark, right; int row, left_mark, right;
char *limits; const char *limits;
{ {
int left, left_edge, nrow, deeper, result; int left, left_edge, nrow, deeper, result;
register int i; register int i;
@@ -2641,7 +2642,7 @@ genericptr_t arg;
int nrow; /* the next row */ int nrow; /* the next row */
int left; /* the left-most visible column */ int left; /* the left-most visible column */
int right; /* the right-most visible column */ int right; /* the right-most visible column */
char *limits; /* range limit for next row */ const char *limits; /* range limit for next row */
/* Set globals for q?_path(), left_side(), and right_side() to use. */ /* Set globals for q?_path(), left_side(), and right_side() to use. */
start_col = scol; start_col = scol;
@@ -2745,7 +2746,7 @@ genericptr_t arg;
} else { } else {
register int x; register int x;
int y, min_x, max_x, max_y, offset; int y, min_x, max_x, max_y, offset;
char *limits; const char *limits;
boolean override_vision; boolean override_vision;
/* vision doesn't pass through water or clouds, detection should /* vision doesn't pass through water or clouds, detection should
+2 -2
View File
@@ -1488,7 +1488,7 @@ const struct def_skill *class_skill;
P_SKILL(P_BARE_HANDED_COMBAT) = P_BASIC; P_SKILL(P_BARE_HANDED_COMBAT) = P_BASIC;
/* Roles that start with a horse know how to ride it */ /* Roles that start with a horse know how to ride it */
if (urole.petnum == PM_PONY) if (g.urole.petnum == PM_PONY)
P_SKILL(P_RIDING) = P_BASIC; P_SKILL(P_RIDING) = P_BASIC;
/* /*
@@ -1507,7 +1507,7 @@ const struct def_skill *class_skill;
/* each role has a special spell; allow at least basic for its type /* each role has a special spell; allow at least basic for its type
(despite the function name, this works for spell skills too) */ (despite the function name, this works for spell skills too) */
unrestrict_weapon_skill(spell_skilltype(urole.spelspec)); unrestrict_weapon_skill(spell_skilltype(g.urole.spelspec));
} }
void void
+2 -2
View File
@@ -606,8 +606,8 @@ can_twoweapon()
You_cant("use two weapons in your current form."); You_cant("use two weapons in your current form.");
else else
pline("%s aren't able to use two weapons at once.", pline("%s aren't able to use two weapons at once.",
makeplural((flags.female && urole.name.f) ? urole.name.f makeplural((flags.female && g.urole.name.f) ? g.urole.name.f
: urole.name.m)); : g.urole.name.m));
} else if (!uwep || !uswapwep) } else if (!uwep || !uswapwep)
Your("%s%s%s empty.", uwep ? "left " : uswapwep ? "right " : "", Your("%s%s%s empty.", uwep ? "left " : uswapwep ? "right " : "",
body_part(HAND), (!uwep && !uswapwep) ? "s are" : " is"); body_part(HAND), (!uwep && !uswapwep) ? "s are" : " is");
+1 -1
View File
@@ -25,7 +25,7 @@ MAIN(int argc, char **argv)
char *dir; char *dir;
boolean resuming = FALSE; /* assume new game */ boolean resuming = FALSE; /* assume new game */
sys_early_init(); early_init();
dir = nh_getenv("NETHACKDIR"); dir = nh_getenv("NETHACKDIR");
if (!dir) if (!dir)
+1 -1
View File
@@ -39,7 +39,7 @@ main(void)
int argc = 1; int argc = 1;
boolean resuming = FALSE; /* assume new game */ boolean resuming = FALSE; /* assume new game */
sys_early_init(); early_init();
windowprocs = mac_procs; windowprocs = mac_procs;
InitMac(); InitMac();
+3 -5
View File
@@ -27,17 +27,15 @@ init_lan_features()
* the other LAN features depend on a unique username being available. * the other LAN features depend on a unique username being available.
* *
*/ */
char lusername[MAX_LAN_USERNAME];
int lusername_size = MAX_LAN_USERNAME;
char * char *
lan_username() lan_username()
{ {
char *lu; char *lu;
lu = get_username(&lusername_size); lu = get_username(&g.lusername_size);
if (lu) { if (lu) {
Strcpy(lusername, lu); Strcpy(g.lusername, lu);
return lusername; return g.lusername;
} else } else
return (char *) 0; return (char *) 0;
} }
+1 -1
View File
@@ -77,7 +77,7 @@ char *argv[];
{ {
boolean resuming; boolean resuming;
sys_early_init(); early_init();
resuming = pcmain(argc, argv); resuming = pcmain(argc, argv);
moveloop(resuming); moveloop(resuming);
nethack_exit(EXIT_SUCCESS); nethack_exit(EXIT_SUCCESS);
+1 -1
View File
@@ -58,7 +58,7 @@ char *argv[];
boolean resuming = FALSE; /* assume new game */ boolean resuming = FALSE; /* assume new game */
boolean plsel_once = FALSE; boolean plsel_once = FALSE;
sys_early_init(); early_init();
#if defined(__APPLE__) #if defined(__APPLE__)
{ {
+1 -1
View File
@@ -44,7 +44,7 @@ char *argv[];
privon(); privon();
#endif #endif
sys_early_init(); early_init();
atexit(byebye); atexit(byebye);
g.hname = argv[0]; g.hname = argv[0];
+1 -1
View File
@@ -42,7 +42,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine,
char buf[NHSTR_BUFSIZE]; char buf[NHSTR_BUFSIZE];
boolean resuming; boolean resuming;
sys_early_init(); early_init();
/* ensure that we don't access violate on a panic() */ /* ensure that we don't access violate on a panic() */
windowprocs.win_raw_print = mswin_raw_print; windowprocs.win_raw_print = mswin_raw_print;
+1 -1
View File
@@ -97,7 +97,7 @@ char *argv[];
if (!GUILaunched) if (!GUILaunched)
windowprocs.win_nhgetch = windows_console_custom_nhgetch; windowprocs.win_nhgetch = windows_console_custom_nhgetch;
sys_early_init(); early_init();
#ifdef _MSC_VER #ifdef _MSC_VER
# ifdef DEBUG # ifdef DEBUG
/* set these appropriately for VS debugging */ /* set these appropriately for VS debugging */
+1 -1
View File
@@ -1237,7 +1237,7 @@ draw_horizontal_new(int x, int y, int hp, int hpmax)
get_playerrank(rank); get_playerrank(rank);
char race[BUFSZ]; char race[BUFSZ];
Strcpy(race, urace.adj); Strcpy(race, g.urace.adj);
race[0] = highc(race[0]); race[0] = highc(race[0]);
wprintw(win, "%s the %s %s%s%s", g.plname, wprintw(win, "%s the %s %s%s%s", g.plname,
(u.ualign.type == A_CHAOTIC ? "Chaotic" : (u.ualign.type == A_CHAOTIC ? "Chaotic" :
+1 -3
View File
@@ -72,8 +72,6 @@ extern short glyph2tile[];
#define HUPSKIP_RESULT(RES) /*empty*/ #define HUPSKIP_RESULT(RES) /*empty*/
#endif /* ?HANGUP_HANDLING */ #endif /* ?HANGUP_HANDLING */
extern char mapped_menu_cmds[]; /* from options.c */
/* this is only needed until tty_status_* routines are written */ /* this is only needed until tty_status_* routines are written */
extern NEARDATA winid WIN_STATUS; extern NEARDATA winid WIN_STATUS;
@@ -1932,7 +1930,7 @@ struct WinDesc *cw;
Strcat(resp, " "); /* next page or end */ Strcat(resp, " "); /* next page or end */
Strcat(resp, "0123456789\033\n\r"); /* counts, quit */ Strcat(resp, "0123456789\033\n\r"); /* counts, quit */
Strcat(resp, gacc); /* group accelerators */ Strcat(resp, gacc); /* group accelerators */
Strcat(resp, mapped_menu_cmds); Strcat(resp, g.mapped_menu_cmds);
if (cw->npages > 1) if (cw->npages > 1)
Sprintf(cw->morestr, "(%d of %d)", curr_page + 1, Sprintf(cw->morestr, "(%d of %d)", curr_page + 1,
+1 -1
View File
@@ -123,7 +123,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
windowprocs.win_wait_synch = mswin_wait_synch; windowprocs.win_wait_synch = mswin_wait_synch;
win10_init(); win10_init();
sys_early_init(); early_init();
/* init application structure */ /* init application structure */
_nethack_app.hApp = hInstance; _nethack_app.hApp = hInstance;