First set of changes to move globals to instance_globals.
This commit is contained in:
@@ -33,9 +33,7 @@ boolean resuming;
|
||||
/* Note: these initializers don't do anything except guarantee that
|
||||
we're linked properly.
|
||||
*/
|
||||
decl_init();
|
||||
monst_init();
|
||||
objects_init();
|
||||
|
||||
/* if a save file created in normal mode is now being restored in
|
||||
explore mode, treat it as normal restore followed by 'X' command
|
||||
|
||||
+12
-19
@@ -5,8 +5,6 @@
|
||||
|
||||
#include "hack.h"
|
||||
|
||||
extern boolean notonhead; /* for long worms */
|
||||
|
||||
STATIC_DCL int FDECL(use_camera, (struct obj *));
|
||||
STATIC_DCL int FDECL(use_towel, (struct obj *));
|
||||
STATIC_DCL boolean FDECL(its_dead, (int, int, int *));
|
||||
@@ -325,7 +323,7 @@ register struct obj *obj;
|
||||
context.stethoscope_movement = youmonst.movement;
|
||||
|
||||
bhitpos.x = u.ux, bhitpos.y = u.uy; /* tentative, reset below */
|
||||
notonhead = u.uswallow;
|
||||
g.notonhead = u.uswallow;
|
||||
if (u.usteed && u.dz > 0) {
|
||||
if (interference) {
|
||||
pline("%s interferes.", Monnam(u.ustuck));
|
||||
@@ -374,7 +372,7 @@ register struct obj *obj;
|
||||
|
||||
/* bhitpos needed by mstatusline() iff mtmp is a long worm */
|
||||
bhitpos.x = rx, bhitpos.y = ry;
|
||||
notonhead = (mtmp->mx != rx || mtmp->my != ry);
|
||||
g.notonhead = (mtmp->mx != rx || mtmp->my != ry);
|
||||
|
||||
if (mtmp->mundetected) {
|
||||
if (!canspotmon(mtmp))
|
||||
@@ -884,7 +882,7 @@ struct obj *obj;
|
||||
mtmp = bhit(u.dx, u.dy, COLNO, INVIS_BEAM,
|
||||
(int FDECL((*), (MONST_P, OBJ_P))) 0,
|
||||
(int FDECL((*), (OBJ_P, OBJ_P))) 0, &obj);
|
||||
if (!mtmp || !haseyes(mtmp->data) || notonhead)
|
||||
if (!mtmp || !haseyes(mtmp->data) || g.notonhead)
|
||||
return 1;
|
||||
|
||||
/* couldsee(mtmp->mx, mtmp->my) is implied by the fact that bhit()
|
||||
@@ -972,7 +970,7 @@ struct obj *obj;
|
||||
;
|
||||
else if ((mtmp->minvis && !perceives(mtmp->data))
|
||||
/* redundant: can't get here if these are true */
|
||||
|| !haseyes(mtmp->data) || notonhead || !mtmp->mcansee)
|
||||
|| !haseyes(mtmp->data) || g.notonhead || !mtmp->mcansee)
|
||||
pline("%s doesn't seem to notice %s reflection.", Monnam(mtmp),
|
||||
mhis(mtmp));
|
||||
else
|
||||
@@ -1600,15 +1598,13 @@ boolean showmsg;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int jumping_is_magic;
|
||||
|
||||
STATIC_OVL boolean
|
||||
get_valid_jump_position(x,y)
|
||||
int x,y;
|
||||
{
|
||||
return (isok(x, y)
|
||||
&& (ACCESSIBLE(levl[x][y].typ) || Passes_walls)
|
||||
&& is_valid_jump_pos(x, y, jumping_is_magic, FALSE));
|
||||
&& is_valid_jump_pos(x, y, g.jumping_is_magic, FALSE));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1722,7 +1718,7 @@ int magic; /* 0=Physical, otherwise skill level */
|
||||
pline("Where do you want to jump?");
|
||||
cc.x = u.ux;
|
||||
cc.y = u.uy;
|
||||
jumping_is_magic = magic;
|
||||
g.jumping_is_magic = magic;
|
||||
getpos_sethilite(display_jump_positions, get_valid_jump_position);
|
||||
if (getpos(&cc, TRUE, "the desired position") < 0)
|
||||
return 0; /* user pressed ESC */
|
||||
@@ -2914,16 +2910,13 @@ int min_range, max_range;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int polearm_range_min = -1;
|
||||
static int polearm_range_max = -1;
|
||||
|
||||
STATIC_OVL boolean
|
||||
get_valid_polearm_position(x, y)
|
||||
int x, y;
|
||||
{
|
||||
return (isok(x, y) && ACCESSIBLE(levl[x][y].typ)
|
||||
&& distu(x, y) >= polearm_range_min
|
||||
&& distu(x, y) <= polearm_range_max);
|
||||
&& distu(x, y) >= g.polearm_range_min
|
||||
&& distu(x, y) <= g.polearm_range_max);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -2995,8 +2988,8 @@ struct obj *obj;
|
||||
else
|
||||
max_range = 8; /* (P_SKILL(typ) >= P_EXPERT) */
|
||||
|
||||
polearm_range_min = min_range;
|
||||
polearm_range_max = max_range;
|
||||
g.polearm_range_min = min_range;
|
||||
g.polearm_range_max = max_range;
|
||||
|
||||
/* Prompt for a location */
|
||||
pline(where_to_hit);
|
||||
@@ -3039,7 +3032,7 @@ struct obj *obj;
|
||||
return 1; /* burn nutrition; maybe pass out */
|
||||
context.polearm.hitmon = mtmp;
|
||||
check_caitiff(mtmp);
|
||||
notonhead = (bhitpos.x != mtmp->mx || bhitpos.y != mtmp->my);
|
||||
g.notonhead = (bhitpos.x != mtmp->mx || bhitpos.y != mtmp->my);
|
||||
(void) thitmonst(mtmp, uwep);
|
||||
} else if (glyph_is_statue(glyph) /* might be hallucinatory */
|
||||
&& sobj_at(STATUE, bhitpos.x, bhitpos.y)) {
|
||||
@@ -3207,7 +3200,7 @@ struct obj *obj;
|
||||
bhitpos = cc;
|
||||
if ((mtmp = m_at(cc.x, cc.y)) == (struct monst *) 0)
|
||||
break;
|
||||
notonhead = (bhitpos.x != mtmp->mx || bhitpos.y != mtmp->my);
|
||||
g.notonhead = (bhitpos.x != mtmp->mx || bhitpos.y != mtmp->my);
|
||||
save_confirm = flags.confirm;
|
||||
if (verysmall(mtmp->data) && !rn2(4)
|
||||
&& enexto(&cc, u.ux, u.uy, (struct permonst *) 0)) {
|
||||
|
||||
+19
-24
@@ -14,8 +14,6 @@
|
||||
* the contents, just the total size.
|
||||
*/
|
||||
|
||||
extern boolean notonhead; /* for long worms */
|
||||
|
||||
#define get_artifact(o) \
|
||||
(((o) && (o)->oartifact) ? &artilist[(int) (o)->oartifact] : 0)
|
||||
|
||||
@@ -41,9 +39,6 @@ STATIC_DCL int FDECL(count_surround_traps, (int, int));
|
||||
of hit points that will fit in a 15 bit integer. */
|
||||
#define FATAL_DAMAGE_MODIFIER 200
|
||||
|
||||
/* coordinate effects from spec_dbon() with messages in artifact_hit() */
|
||||
STATIC_OVL int spec_dbon_applies = 0;
|
||||
|
||||
/* flags including which artifacts have already been created */
|
||||
static boolean artiexist[1 + NROFARTIFACTS + 1];
|
||||
/* and a discovery list for them (no dummy first entry here) */
|
||||
@@ -540,7 +535,7 @@ long wp_mask;
|
||||
* that can print a message--need to guard against being printed
|
||||
* when restoring a game
|
||||
*/
|
||||
(void) make_hallucinated((long) !on, restoring ? FALSE : TRUE,
|
||||
(void) make_hallucinated((long) !on, g.restoring ? FALSE : TRUE,
|
||||
wp_mask);
|
||||
}
|
||||
if (spfx & SPFX_ESP) {
|
||||
@@ -848,15 +843,15 @@ int tmp;
|
||||
|
||||
if (!weap || (weap->attk.adtyp == AD_PHYS /* check for `NO_ATTK' */
|
||||
&& weap->attk.damn == 0 && weap->attk.damd == 0))
|
||||
spec_dbon_applies = FALSE;
|
||||
g.spec_dbon_applies = FALSE;
|
||||
else if (otmp->oartifact == ART_GRIMTOOTH)
|
||||
/* Grimtooth has SPFX settings to warn against elves but we want its
|
||||
damage bonus to apply to all targets, so bypass spec_applies() */
|
||||
spec_dbon_applies = TRUE;
|
||||
g.spec_dbon_applies = TRUE;
|
||||
else
|
||||
spec_dbon_applies = spec_applies(weap, mon);
|
||||
g.spec_dbon_applies = spec_applies(weap, mon);
|
||||
|
||||
if (spec_dbon_applies)
|
||||
if (g.spec_dbon_applies)
|
||||
return weap->attk.damd ? rnd((int) weap->attk.damd) : max(tmp, 1);
|
||||
return 0;
|
||||
}
|
||||
@@ -980,14 +975,14 @@ char *hittee; /* target's name: "you" or mon_nam(mdef) */
|
||||
scare_dieroll /= (1 << (mb->spe / 3));
|
||||
/* if target successfully resisted the artifact damage bonus,
|
||||
reduce overall likelihood of the assorted special effects */
|
||||
if (!spec_dbon_applies)
|
||||
if (!g.spec_dbon_applies)
|
||||
dieroll += 1;
|
||||
|
||||
/* might stun even when attempting a more severe effect, but
|
||||
in that case it will only happen if the other effect fails;
|
||||
extra damage will apply regardless; 3.4.1: sometimes might
|
||||
just probe even when it hasn't been enchanted */
|
||||
do_stun = (max(mb->spe, 0) < rn2(spec_dbon_applies ? 11 : 7));
|
||||
do_stun = (max(mb->spe, 0) < rn2(g.spec_dbon_applies ? 11 : 7));
|
||||
|
||||
/* the special effects also boost physical damage; increments are
|
||||
generally cumulative, but since the stun effect is based on a
|
||||
@@ -1186,12 +1181,12 @@ int dieroll; /* needed for Magicbane and vorpal blades */
|
||||
if (attacks(AD_FIRE, otmp)) {
|
||||
if (realizes_damage)
|
||||
pline_The("fiery blade %s %s%c",
|
||||
!spec_dbon_applies
|
||||
!g.spec_dbon_applies
|
||||
? "hits"
|
||||
: (mdef->data == &mons[PM_WATER_ELEMENTAL])
|
||||
? "vaporizes part of"
|
||||
: "burns",
|
||||
hittee, !spec_dbon_applies ? '.' : '!');
|
||||
hittee, !g.spec_dbon_applies ? '.' : '!');
|
||||
if (!rn2(4))
|
||||
(void) destroy_mitem(mdef, POTION_CLASS, AD_FIRE);
|
||||
if (!rn2(4))
|
||||
@@ -1205,8 +1200,8 @@ int dieroll; /* needed for Magicbane and vorpal blades */
|
||||
if (attacks(AD_COLD, otmp)) {
|
||||
if (realizes_damage)
|
||||
pline_The("ice-cold blade %s %s%c",
|
||||
!spec_dbon_applies ? "hits" : "freezes", hittee,
|
||||
!spec_dbon_applies ? '.' : '!');
|
||||
!g.spec_dbon_applies ? "hits" : "freezes", hittee,
|
||||
!g.spec_dbon_applies ? '.' : '!');
|
||||
if (!rn2(4))
|
||||
(void) destroy_mitem(mdef, POTION_CLASS, AD_COLD);
|
||||
return realizes_damage;
|
||||
@@ -1214,9 +1209,9 @@ int dieroll; /* needed for Magicbane and vorpal blades */
|
||||
if (attacks(AD_ELEC, otmp)) {
|
||||
if (realizes_damage)
|
||||
pline_The("massive hammer hits%s %s%c",
|
||||
!spec_dbon_applies ? "" : "! Lightning strikes",
|
||||
hittee, !spec_dbon_applies ? '.' : '!');
|
||||
if (spec_dbon_applies)
|
||||
!g.spec_dbon_applies ? "" : "! Lightning strikes",
|
||||
hittee, !g.spec_dbon_applies ? '.' : '!');
|
||||
if (g.spec_dbon_applies)
|
||||
wake_nearto(mdef->mx, mdef->my, 4 * 4);
|
||||
if (!rn2(5))
|
||||
(void) destroy_mitem(mdef, RING_CLASS, AD_ELEC);
|
||||
@@ -1227,10 +1222,10 @@ int dieroll; /* needed for Magicbane and vorpal blades */
|
||||
if (attacks(AD_MAGM, otmp)) {
|
||||
if (realizes_damage)
|
||||
pline_The("imaginary widget hits%s %s%c",
|
||||
!spec_dbon_applies
|
||||
!g.spec_dbon_applies
|
||||
? ""
|
||||
: "! A hail of magic missiles strikes",
|
||||
hittee, !spec_dbon_applies ? '.' : '!');
|
||||
hittee, !g.spec_dbon_applies ? '.' : '!');
|
||||
return realizes_damage;
|
||||
}
|
||||
|
||||
@@ -1239,7 +1234,7 @@ int dieroll; /* needed for Magicbane and vorpal blades */
|
||||
return Mb_hit(magr, mdef, otmp, dmgptr, dieroll, vis, hittee);
|
||||
}
|
||||
|
||||
if (!spec_dbon_applies) {
|
||||
if (!g.spec_dbon_applies) {
|
||||
/* since damage bonus didn't apply, nothing more to do;
|
||||
no further attacks have side-effects on inventory */
|
||||
return FALSE;
|
||||
@@ -1258,7 +1253,7 @@ int dieroll; /* needed for Magicbane and vorpal blades */
|
||||
}
|
||||
if (!youdefend) {
|
||||
/* allow normal cutworm() call to add extra damage */
|
||||
if (notonhead)
|
||||
if (g.notonhead)
|
||||
return FALSE;
|
||||
|
||||
if (bigmonst(mdef->data)) {
|
||||
@@ -1301,7 +1296,7 @@ int dieroll; /* needed for Magicbane and vorpal blades */
|
||||
return FALSE;
|
||||
wepdesc = artilist[ART_VORPAL_BLADE].name;
|
||||
if (!youdefend) {
|
||||
if (!has_head(mdef->data) || notonhead || u.uswallow) {
|
||||
if (!has_head(mdef->data) || g.notonhead || u.uswallow) {
|
||||
if (youattack)
|
||||
pline("Somehow, you miss %s wildly.", mon_nam(mdef));
|
||||
else if (vis)
|
||||
|
||||
+2
-3
@@ -13,7 +13,6 @@ extern const char *hu_stat[]; /* defined in eat.c */
|
||||
const char *const enc_stat[] = { "", "Burdened", "Stressed",
|
||||
"Strained", "Overtaxed", "Overloaded" };
|
||||
|
||||
STATIC_OVL NEARDATA int mrank_sz = 0; /* loaded by max_rank_sz (from u_init) */
|
||||
STATIC_DCL const char *NDECL(rank);
|
||||
#ifdef STATUS_HILITES
|
||||
STATIC_DCL void NDECL(bot_via_windowport);
|
||||
@@ -67,7 +66,7 @@ do_statusline1()
|
||||
Strcpy(nb = eos(nb), rank());
|
||||
|
||||
Sprintf(nb = eos(nb), " ");
|
||||
i = mrank_sz + 15;
|
||||
i = g.mrank_sz + 15;
|
||||
j = (int) ((nb + 2) - newbot1); /* strlen(newbot1) but less computation */
|
||||
if ((i - j) > 0)
|
||||
Sprintf(nb = eos(nb), "%*s", i - j, " "); /* pad with spaces */
|
||||
@@ -349,7 +348,7 @@ max_rank_sz()
|
||||
if (urole.rank[i].f && (r = strlen(urole.rank[i].f)) > maxr)
|
||||
maxr = r;
|
||||
}
|
||||
mrank_sz = maxr;
|
||||
g.mrank_sz = maxr;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -5788,8 +5788,7 @@ char def;
|
||||
{
|
||||
char res, qbuf[QBUFSZ];
|
||||
#ifdef DUMPLOG
|
||||
extern unsigned saved_pline_index; /* pline.c */
|
||||
unsigned idx = saved_pline_index;
|
||||
unsigned idx = g.saved_pline_index;
|
||||
/* buffer to hold query+space+formatted_single_char_response */
|
||||
char dumplog_buf[QBUFSZ + 1 + 15]; /* [QBUFSZ+1+7] should suffice */
|
||||
#endif
|
||||
@@ -5806,7 +5805,7 @@ char def;
|
||||
}
|
||||
res = (*windowprocs.win_yn_function)(query, resp, def);
|
||||
#ifdef DUMPLOG
|
||||
if (idx == saved_pline_index) {
|
||||
if (idx == g.saved_pline_index) {
|
||||
/* when idx is still the same as saved_pline_index, the interface
|
||||
didn't put the prompt into saved_plines[]; we put a simplified
|
||||
version in there now (without response choices or default) */
|
||||
|
||||
+106
-27
@@ -285,7 +285,7 @@ char *fqn_prefix_names[PREFIX_COUNT] = {
|
||||
};
|
||||
#endif
|
||||
|
||||
NEARDATA struct savefile_info sfcap = {
|
||||
const struct savefile_info default_sfinfo = {
|
||||
#ifdef NHSTDC
|
||||
0x00000000UL
|
||||
#else
|
||||
@@ -308,28 +308,7 @@ NEARDATA struct savefile_info sfcap = {
|
||||
#endif
|
||||
};
|
||||
|
||||
NEARDATA struct savefile_info sfrestinfo, sfsaveinfo = {
|
||||
#ifdef NHSTDC
|
||||
0x00000000UL
|
||||
#else
|
||||
0x00000000L
|
||||
#endif
|
||||
#if defined(COMPRESS) || defined(ZLIB_COMP)
|
||||
| SFI1_EXTERNALCOMP
|
||||
#endif
|
||||
#if defined(ZEROCOMP)
|
||||
| SFI1_ZEROCOMP
|
||||
#endif
|
||||
#if defined(RLECOMP)
|
||||
| SFI1_RLECOMP
|
||||
#endif
|
||||
,
|
||||
#ifdef NHSTDC
|
||||
0x00000000UL, 0x00000000UL
|
||||
#else
|
||||
0x00000000L, 0x00000000L
|
||||
#endif
|
||||
};
|
||||
NEARDATA struct savefile_info sfcap, sfrestinfo, sfsaveinfo;
|
||||
|
||||
struct plinemsg_type *plinemsg_types = (struct plinemsg_type *) 0;
|
||||
|
||||
@@ -340,11 +319,111 @@ const char *ARGV0;
|
||||
/* support for lint.h */
|
||||
unsigned nhUse_dummy = 0;
|
||||
|
||||
/* dummy routine used to force linkage */
|
||||
void
|
||||
decl_init()
|
||||
#define IVMAGIC 0xdeadbeef
|
||||
|
||||
const struct instance_globals g_init = {
|
||||
/* apply.c */
|
||||
0, /* jumping_is_magic */
|
||||
-1, /* polearm_range_min */
|
||||
-1, /* polearm_range_max */
|
||||
|
||||
/* artifact.c */
|
||||
0, /* spec_dbon_applies */
|
||||
|
||||
/* botl.c */
|
||||
0, /* mrank_sz */
|
||||
|
||||
/* dog.c */
|
||||
0, /* petname_used */
|
||||
|
||||
/* mused.c */
|
||||
FALSE, /* m_using */
|
||||
|
||||
/* objname.c */
|
||||
0, /* distantname */
|
||||
|
||||
/* pickup.c */
|
||||
0, /* oldcap */
|
||||
UNDEFINED_PTR, /* current_container */
|
||||
UNDEFINED_VALUE, /* abort_looting */
|
||||
|
||||
/* pline.c */
|
||||
0, /* pline_flags */
|
||||
UNDEFINED_VALUES, /* prevmsg */
|
||||
#ifdef DUMPLOG
|
||||
0, /* saved_pline_index */
|
||||
UNDEFINED_VALUES,
|
||||
#endif
|
||||
|
||||
/* polyself.c */
|
||||
0, /* sex_change_ok */
|
||||
|
||||
/* potion.c */
|
||||
FALSE, /* notonhead */
|
||||
UNDEFINED_VALUE, /* potion_nothing */
|
||||
UNDEFINED_VALUE, /* potion_unkn */
|
||||
|
||||
/* read.c */
|
||||
UNDEFINED_VALUE, /* known */
|
||||
|
||||
/* restore.c */
|
||||
0, /* n_ids_mapped */
|
||||
0, /* id_map */
|
||||
FALSE, /* restoring */
|
||||
UNDEFINED_PTR, /* oldfruit */
|
||||
UNDEFINED_VALUE, /* omoves */
|
||||
|
||||
/* rumors.c */
|
||||
0, /* true_rumor_size */
|
||||
0, /* false_rumor_size */
|
||||
UNDEFINED_VALUE, /* true_rumor_start*/
|
||||
UNDEFINED_VALUE, /* false_rumor_start*/
|
||||
UNDEFINED_VALUE, /* true_rumor_end */
|
||||
UNDEFINED_VALUE, /* false_rumor_end */
|
||||
0, /* oracle_flag */
|
||||
0, /* oracle_cnt */
|
||||
NULL, /* oracle_loc */
|
||||
|
||||
/* save.c */
|
||||
TRUE, /* havestate*/
|
||||
0, /* ustuck_id */
|
||||
0, /* usteed_id */
|
||||
|
||||
/* trap.c */
|
||||
0, /* force_mintrap */
|
||||
|
||||
/* u_init.c */
|
||||
STRANGE_OBJECT, /* nocreate */
|
||||
STRANGE_OBJECT, /* nocreate2 */
|
||||
STRANGE_OBJECT, /* nocreate3 */
|
||||
STRANGE_OBJECT, /* nocreate4 */
|
||||
|
||||
/* uhitm.c */
|
||||
UNDEFINED_VALUE, /* override_confirmation */
|
||||
|
||||
/* weapon.c */
|
||||
UNDEFINED_PTR, /* propellor */
|
||||
|
||||
/* zap.c */
|
||||
UNDEFINED_VALUE, /* poly_zap */
|
||||
UNDEFINED_VALUE, /* obj_zapped */
|
||||
|
||||
IVMAGIC /* used to validate that structure layout has been preserved */
|
||||
};
|
||||
|
||||
struct instance_globals g;
|
||||
|
||||
void
|
||||
decl_globals_init()
|
||||
{
|
||||
return;
|
||||
g = g_init;
|
||||
|
||||
nhassert(g_init.magic == IVMAGIC);
|
||||
nhassert(g_init.havestate == TRUE);
|
||||
|
||||
sfcap = default_sfinfo;
|
||||
sfrestinfo = default_sfinfo;
|
||||
sfsaveinfo = default_sfinfo;
|
||||
}
|
||||
|
||||
/*decl.c*/
|
||||
|
||||
+9
-11
@@ -11,8 +11,6 @@
|
||||
#include "hack.h"
|
||||
#include "artifact.h"
|
||||
|
||||
extern boolean known; /* from read.c */
|
||||
|
||||
STATIC_DCL boolean NDECL(unconstrain_map);
|
||||
STATIC_DCL void NDECL(reconstrain_map);
|
||||
STATIC_DCL void FDECL(browse_map, (int, const char *));
|
||||
@@ -307,7 +305,7 @@ register struct obj *sobj;
|
||||
boolean stale, ugold = FALSE, steedgold = FALSE;
|
||||
int ter_typ = TER_DETECT | TER_OBJ;
|
||||
|
||||
known = stale = clear_stale_map(COIN_CLASS,
|
||||
g.known = stale = clear_stale_map(COIN_CLASS,
|
||||
(unsigned) (sobj->blessed ? GOLD : 0));
|
||||
|
||||
/* look for gold carried by monsters (might be in a container) */
|
||||
@@ -318,7 +316,7 @@ register struct obj *sobj;
|
||||
if (mtmp == u.usteed) {
|
||||
steedgold = TRUE;
|
||||
} else {
|
||||
known = TRUE;
|
||||
g.known = TRUE;
|
||||
goto outgoldmap; /* skip further searching */
|
||||
}
|
||||
} else {
|
||||
@@ -328,7 +326,7 @@ register struct obj *sobj;
|
||||
if (mtmp == u.usteed) {
|
||||
steedgold = TRUE;
|
||||
} else {
|
||||
known = TRUE;
|
||||
g.known = TRUE;
|
||||
goto outgoldmap; /* skip further searching */
|
||||
}
|
||||
}
|
||||
@@ -338,17 +336,17 @@ register struct obj *sobj;
|
||||
/* look for gold objects */
|
||||
for (obj = fobj; obj; obj = obj->nobj) {
|
||||
if (sobj->blessed && o_material(obj, GOLD)) {
|
||||
known = TRUE;
|
||||
g.known = TRUE;
|
||||
if (obj->ox != u.ux || obj->oy != u.uy)
|
||||
goto outgoldmap;
|
||||
} else if (o_in(obj, COIN_CLASS)) {
|
||||
known = TRUE;
|
||||
g.known = TRUE;
|
||||
if (obj->ox != u.ux || obj->oy != u.uy)
|
||||
goto outgoldmap;
|
||||
}
|
||||
}
|
||||
|
||||
if (!known) {
|
||||
if (!g.known) {
|
||||
/* no gold found on floor or monster's inventory.
|
||||
adjust message if you have gold in your inventory */
|
||||
if (sobj) {
|
||||
@@ -484,7 +482,7 @@ register struct obj *sobj;
|
||||
}
|
||||
|
||||
if (!ct && !ctu) {
|
||||
known = stale && !confused;
|
||||
g.known = stale && !confused;
|
||||
if (stale) {
|
||||
docrt();
|
||||
You("sense a lack of %s nearby.", what);
|
||||
@@ -512,7 +510,7 @@ register struct obj *sobj;
|
||||
}
|
||||
return !stale;
|
||||
} else if (!ct) {
|
||||
known = TRUE;
|
||||
g.known = TRUE;
|
||||
You("%s %s nearby.", sobj ? "smell" : "sense", what);
|
||||
if (sobj && sobj->blessed) {
|
||||
if (!u.uedibility)
|
||||
@@ -523,7 +521,7 @@ register struct obj *sobj;
|
||||
struct obj *temp;
|
||||
int ter_typ = TER_DETECT | TER_OBJ;
|
||||
|
||||
known = TRUE;
|
||||
g.known = TRUE;
|
||||
cls();
|
||||
(void) unconstrain_map();
|
||||
for (obj = fobj; obj; obj = obj->nobj)
|
||||
|
||||
@@ -160,7 +160,6 @@ makedog()
|
||||
register struct obj *otmp;
|
||||
const char *petname;
|
||||
int pettype;
|
||||
static int petname_used = 0;
|
||||
|
||||
if (preferred_pet == 'n')
|
||||
return ((struct monst *) 0);
|
||||
@@ -198,7 +197,7 @@ makedog()
|
||||
put_saddle_on_mon(otmp, mtmp);
|
||||
}
|
||||
|
||||
if (!petname_used++ && *petname)
|
||||
if (!g.petname_used++ && *petname)
|
||||
mtmp = christen_monst(mtmp, petname);
|
||||
|
||||
initedog(mtmp);
|
||||
|
||||
+1
-3
@@ -7,8 +7,6 @@
|
||||
|
||||
#include "mfndpos.h"
|
||||
|
||||
extern boolean notonhead;
|
||||
|
||||
STATIC_DCL boolean FDECL(dog_hunger, (struct monst *, struct edog *));
|
||||
STATIC_DCL int FDECL(dog_invent, (struct monst *, struct edog *, int));
|
||||
STATIC_DCL int FDECL(dog_goal, (struct monst *, struct edog *, int, int, int));
|
||||
@@ -1023,7 +1021,7 @@ int after; /* this is extra fast monster movement */
|
||||
if (after)
|
||||
return 0; /* hit only once each move */
|
||||
|
||||
notonhead = 0;
|
||||
g.notonhead = 0;
|
||||
mstatus = mattackm(mtmp, mtmp2);
|
||||
|
||||
/* aggressor (pet) died */
|
||||
|
||||
+1
-3
@@ -14,8 +14,6 @@ static NEARDATA const char *gate_str;
|
||||
|
||||
/* kickedobj (decl.c) tracks a kicked object until placed or destroyed */
|
||||
|
||||
extern boolean notonhead; /* for long worms */
|
||||
|
||||
STATIC_DCL void FDECL(kickdmg, (struct monst *, BOOLEAN_P));
|
||||
STATIC_DCL boolean FDECL(maybe_kick_monster, (struct monst *,
|
||||
XCHAR_P, XCHAR_P));
|
||||
@@ -679,7 +677,7 @@ xchar x, y;
|
||||
if (mon->isshk && kickedobj->where == OBJ_MINVENT
|
||||
&& kickedobj->ocarry == mon)
|
||||
return 1; /* alert shk caught it */
|
||||
notonhead = (mon->mx != bhitpos.x || mon->my != bhitpos.y);
|
||||
g.notonhead = (mon->mx != bhitpos.x || mon->my != bhitpos.y);
|
||||
if (isgold ? ghitm(mon, kickedobj) /* caught? */
|
||||
: thitmonst(mon, kickedobj)) /* hit && used up? */
|
||||
return 1;
|
||||
|
||||
+2
-4
@@ -28,8 +28,6 @@ static NEARDATA const char bullets[] = { ALLOW_COUNT, COIN_CLASS, ALL_CLASSES,
|
||||
|
||||
/* thrownobj (decl.c) tracks an object until it lands */
|
||||
|
||||
extern boolean notonhead; /* for long worms */
|
||||
|
||||
/* Throw the selected object, asking for direction */
|
||||
STATIC_OVL int
|
||||
throw_obj(obj, shotlimit)
|
||||
@@ -1095,7 +1093,7 @@ boolean twoweap; /* used to restore twoweapon mode if wielded weapon returns */
|
||||
|| Hallucination || Fumbling);
|
||||
boolean tethered_weapon = (obj->otyp == AKLYS && (wep_mask & W_WEP) != 0);
|
||||
|
||||
notonhead = FALSE; /* reset potentially stale value */
|
||||
g.notonhead = FALSE; /* reset potentially stale value */
|
||||
if ((obj->cursed || obj->greased) && (u.dx || u.dy) && !rn2(7)) {
|
||||
boolean slipok = TRUE;
|
||||
|
||||
@@ -1268,7 +1266,7 @@ boolean twoweap; /* used to restore twoweapon mode if wielded weapon returns */
|
||||
return; /* alert shk caught it */
|
||||
}
|
||||
(void) snuff_candle(obj);
|
||||
notonhead = (bhitpos.x != mon->mx || bhitpos.y != mon->my);
|
||||
g.notonhead = (bhitpos.x != mon->mx || bhitpos.y != mon->my);
|
||||
obj_gone = thitmonst(mon, obj);
|
||||
/* Monster may have been tamed; this frees old mon */
|
||||
mon = m_at(bhitpos.x, bhitpos.y);
|
||||
|
||||
@@ -101,7 +101,7 @@ register struct obj *obj;
|
||||
|| (obj->otyp == EGG));
|
||||
|
||||
if (u.umonnum == PM_GELATINOUS_CUBE && is_organic(obj)
|
||||
/* [g.cubes can eat containers and retain all contents
|
||||
/* [g-cubes can eat containers and retain all contents
|
||||
as engulfed items, but poly'd player can't do that] */
|
||||
&& !Has_contents(obj))
|
||||
return TRUE;
|
||||
|
||||
@@ -681,14 +681,12 @@ dump_plines()
|
||||
{
|
||||
int i, j;
|
||||
char buf[BUFSZ], **strp;
|
||||
extern char *saved_plines[];
|
||||
extern unsigned saved_pline_index;
|
||||
|
||||
Strcpy(buf, " "); /* one space for indentation */
|
||||
putstr(0, 0, "Latest messages:");
|
||||
for (i = 0, j = (int) saved_pline_index; i < DUMPLOG_MSG_COUNT;
|
||||
for (i = 0, j = (int) g.saved_pline_index; i < DUMPLOG_MSG_COUNT;
|
||||
++i, j = (j + 1) % DUMPLOG_MSG_COUNT) {
|
||||
strp = &saved_plines[j];
|
||||
strp = &g.saved_plines[j];
|
||||
if (*strp) {
|
||||
copynchars(&buf[1], *strp, BUFSZ - 1 - 1);
|
||||
putstr(0, 0, buf);
|
||||
|
||||
+2
-2
@@ -1155,10 +1155,10 @@ int x,y;
|
||||
int tx = u.tx;
|
||||
int ty = u.ty;
|
||||
boolean ret;
|
||||
int g = glyph_at(x,y);
|
||||
int glyph = glyph_at(x,y);
|
||||
if (x == u.ux && y == u.uy)
|
||||
return TRUE;
|
||||
if (isok(x,y) && glyph_is_cmap(g) && S_stone == glyph_to_cmap(g)
|
||||
if (isok(x,y) && glyph_is_cmap(glyph) && S_stone == glyph_to_cmap(glyph)
|
||||
&& !levl[x][y].seenv)
|
||||
return FALSE;
|
||||
u.tx = x;
|
||||
|
||||
+8
-8
@@ -1008,33 +1008,33 @@ char *buf;
|
||||
int k;
|
||||
time_t timeresult = (time_t) 0;
|
||||
struct tm t, *lt;
|
||||
char *g, *p, y[5], mo[3], md[3], h[3], mi[3], s[3];
|
||||
char *d, *p, y[5], mo[3], md[3], h[3], mi[3], s[3];
|
||||
|
||||
if (buf && strlen(buf) == 14) {
|
||||
g = buf;
|
||||
d = buf;
|
||||
p = y; /* year */
|
||||
for (k = 0; k < 4; ++k)
|
||||
*p++ = *g++;
|
||||
*p++ = *d++;
|
||||
*p = '\0';
|
||||
p = mo; /* month */
|
||||
for (k = 0; k < 2; ++k)
|
||||
*p++ = *g++;
|
||||
*p++ = *d++;
|
||||
*p = '\0';
|
||||
p = md; /* day */
|
||||
for (k = 0; k < 2; ++k)
|
||||
*p++ = *g++;
|
||||
*p++ = *d++;
|
||||
*p = '\0';
|
||||
p = h; /* hour */
|
||||
for (k = 0; k < 2; ++k)
|
||||
*p++ = *g++;
|
||||
*p++ = *d++;
|
||||
*p = '\0';
|
||||
p = mi; /* minutes */
|
||||
for (k = 0; k < 2; ++k)
|
||||
*p++ = *g++;
|
||||
*p++ = *d++;
|
||||
*p = '\0';
|
||||
p = s; /* seconds */
|
||||
for (k = 0; k < 2; ++k)
|
||||
*p++ = *g++;
|
||||
*p++ = *d++;
|
||||
*p = '\0';
|
||||
lt = getlt();
|
||||
if (lt) {
|
||||
|
||||
+3
-5
@@ -6,8 +6,6 @@
|
||||
#include "hack.h"
|
||||
#include "artifact.h"
|
||||
|
||||
extern boolean notonhead;
|
||||
|
||||
static NEARDATA boolean vis, far_noise;
|
||||
static NEARDATA long noisetime;
|
||||
static NEARDATA struct obj *otmp;
|
||||
@@ -161,7 +159,7 @@ register struct monst *mtmp;
|
||||
/* mtmp can be killed */
|
||||
bhitpos.x = mon->mx;
|
||||
bhitpos.y = mon->my;
|
||||
notonhead = 0;
|
||||
g.notonhead = 0;
|
||||
result = mattackm(mtmp, mon);
|
||||
|
||||
if (result & MM_AGR_DIED)
|
||||
@@ -179,7 +177,7 @@ register struct monst *mtmp;
|
||||
if ((result & MM_HIT) && !(result & MM_DEF_DIED) && rn2(4)
|
||||
&& mon->movement >= NORMAL_SPEED) {
|
||||
mon->movement -= NORMAL_SPEED;
|
||||
notonhead = 0;
|
||||
g.notonhead = 0;
|
||||
(void) mattackm(mon, mtmp); /* return attack */
|
||||
}
|
||||
|
||||
@@ -1334,7 +1332,7 @@ register struct attack *mattk;
|
||||
}
|
||||
break;
|
||||
case AD_DRIN:
|
||||
if (notonhead || !has_head(pd)) {
|
||||
if (g.notonhead || !has_head(pd)) {
|
||||
if (vis && canspotmon(mdef))
|
||||
pline("%s doesn't seem harmed.", Monnam(mdef));
|
||||
/* Not clear what to do for green slimes */
|
||||
|
||||
@@ -945,7 +945,7 @@ struct monst *mtmp;
|
||||
|
||||
/* eat organic objects, including cloth and wood, if present;
|
||||
engulf others, except huge rocks and metal attached to player
|
||||
[despite comment at top, doesn't assume that eater is a g.cube] */
|
||||
[despite comment at top, doesn't assume that eater is a g-cube] */
|
||||
for (otmp = level.objects[mtmp->mx][mtmp->my]; otmp; otmp = otmp2) {
|
||||
otmp2 = otmp->nexthere;
|
||||
|
||||
@@ -1020,7 +1020,7 @@ struct monst *mtmp;
|
||||
register struct obj *otmp3;
|
||||
|
||||
/* contents of eaten containers become engulfed; this
|
||||
is arbitrary, but otherwise g.cubes are too powerful */
|
||||
is arbitrary, but otherwise g-cubes are too powerful */
|
||||
while ((otmp3 = otmp->cobj) != 0) {
|
||||
obj_extract_self(otmp3);
|
||||
if (otmp->otyp == ICE_BOX && otmp3->otyp == CORPSE) {
|
||||
|
||||
+3
-5
@@ -7,8 +7,6 @@
|
||||
#include "mfndpos.h"
|
||||
#include "artifact.h"
|
||||
|
||||
extern boolean notonhead;
|
||||
|
||||
STATIC_DCL void FDECL(watch_on_duty, (struct monst *));
|
||||
STATIC_DCL int FDECL(disturb, (struct monst *));
|
||||
STATIC_DCL void FDECL(release_hero, (struct monst *));
|
||||
@@ -858,7 +856,7 @@ register int after;
|
||||
*/
|
||||
if ((dist2(mtmp->mx, mtmp->my, tx, ty) < 2) && intruder
|
||||
&& (intruder != mtmp)) {
|
||||
notonhead = (intruder->mx != tx || intruder->my != ty);
|
||||
g.notonhead = (intruder->mx != tx || intruder->my != ty);
|
||||
if (mattackm(mtmp, intruder) == 2)
|
||||
return 2;
|
||||
mmoved = 1;
|
||||
@@ -1203,7 +1201,7 @@ not_special:
|
||||
int mstatus;
|
||||
mtmp2 = m_at(nix, niy);
|
||||
|
||||
notonhead = mtmp2 && (nix != mtmp2->mx || niy != mtmp2->my);
|
||||
g.notonhead = mtmp2 && (nix != mtmp2->mx || niy != mtmp2->my);
|
||||
/* note: mstatus returns 0 if mtmp2 is nonexistent */
|
||||
mstatus = mattackm(mtmp, mtmp2);
|
||||
|
||||
@@ -1213,7 +1211,7 @@ not_special:
|
||||
if ((mstatus & MM_HIT) && !(mstatus & MM_DEF_DIED) && rn2(4)
|
||||
&& mtmp2->movement >= NORMAL_SPEED) {
|
||||
mtmp2->movement -= NORMAL_SPEED;
|
||||
notonhead = 0;
|
||||
g.notonhead = 0;
|
||||
mstatus = mattackm(mtmp2, mtmp); /* return attack */
|
||||
if (mstatus & MM_DEF_DIED)
|
||||
return 2;
|
||||
|
||||
+2
-3
@@ -26,7 +26,6 @@ STATIC_OVL NEARDATA const char *breathwep[] = {
|
||||
"strange breath #9"
|
||||
};
|
||||
|
||||
extern boolean notonhead; /* for long worms */
|
||||
STATIC_VAR int mesg_given; /* for m_throw()/thitu() 'miss' message */
|
||||
|
||||
/* hero is hit by something other than a monster */
|
||||
@@ -312,7 +311,7 @@ boolean verbose; /* give message(s) even when you can't see what happened */
|
||||
int objgone = 1;
|
||||
struct obj *mon_launcher = archer ? MON_WEP(archer) : NULL;
|
||||
|
||||
notonhead = (bhitpos.x != mtmp->mx || bhitpos.y != mtmp->my);
|
||||
g.notonhead = (bhitpos.x != mtmp->mx || bhitpos.y != mtmp->my);
|
||||
ismimic = mtmp->m_ap_type && mtmp->m_ap_type != M_AP_MONSTER;
|
||||
vis = cansee(bhitpos.x, bhitpos.y);
|
||||
|
||||
@@ -477,7 +476,7 @@ struct obj *obj; /* missile (or stack providing it) */
|
||||
|
||||
bhitpos.x = x;
|
||||
bhitpos.y = y;
|
||||
notonhead = FALSE; /* reset potentially stale value */
|
||||
g.notonhead = FALSE; /* reset potentially stale value */
|
||||
|
||||
if (obj->quan == 1L) {
|
||||
/*
|
||||
|
||||
+8
-10
@@ -8,8 +8,6 @@
|
||||
|
||||
#include "hack.h"
|
||||
|
||||
boolean m_using = FALSE;
|
||||
|
||||
/* Let monsters use magic items. Arbitrary assumptions: Monsters only use
|
||||
* scrolls when they can see, monsters know when wands have 0 charges,
|
||||
* monsters cannot recognize if items are cursed are not, monsters which
|
||||
@@ -670,12 +668,12 @@ struct monst *mtmp;
|
||||
zap_oseen = oseen;
|
||||
mzapmsg(mtmp, otmp, FALSE);
|
||||
otmp->spe--;
|
||||
m_using = TRUE;
|
||||
g.m_using = TRUE;
|
||||
mbhit(mtmp, rn1(8, 6), mbhitm, bhito, otmp);
|
||||
/* monster learns that teleportation isn't useful here */
|
||||
if (level.flags.noteleport)
|
||||
mtmp->mtrapseen |= (1 << (TELEP_TRAP - 1));
|
||||
m_using = FALSE;
|
||||
g.m_using = FALSE;
|
||||
return 2;
|
||||
case MUSE_SCR_TELEPORTATION: {
|
||||
int obj_is_cursed = otmp->cursed;
|
||||
@@ -1399,11 +1397,11 @@ struct monst *mtmp;
|
||||
otmp->spe--;
|
||||
if (oseen)
|
||||
makeknown(otmp->otyp);
|
||||
m_using = TRUE;
|
||||
g.m_using = TRUE;
|
||||
buzz((int) (-30 - (otmp->otyp - WAN_MAGIC_MISSILE)),
|
||||
(otmp->otyp == WAN_MAGIC_MISSILE) ? 2 : 6, mtmp->mx, mtmp->my,
|
||||
sgn(mtmp->mux - mtmp->mx), sgn(mtmp->muy - mtmp->my));
|
||||
m_using = FALSE;
|
||||
g.m_using = FALSE;
|
||||
return (DEADMONSTER(mtmp)) ? 1 : 2;
|
||||
case MUSE_FIRE_HORN:
|
||||
case MUSE_FROST_HORN:
|
||||
@@ -1413,20 +1411,20 @@ struct monst *mtmp;
|
||||
} else
|
||||
You_hear("a horn being played.");
|
||||
otmp->spe--;
|
||||
m_using = TRUE;
|
||||
g.m_using = TRUE;
|
||||
buzz(-30 - ((otmp->otyp == FROST_HORN) ? AD_COLD - 1 : AD_FIRE - 1),
|
||||
rn1(6, 6), mtmp->mx, mtmp->my, sgn(mtmp->mux - mtmp->mx),
|
||||
sgn(mtmp->muy - mtmp->my));
|
||||
m_using = FALSE;
|
||||
g.m_using = FALSE;
|
||||
return (DEADMONSTER(mtmp)) ? 1 : 2;
|
||||
case MUSE_WAN_TELEPORTATION:
|
||||
case MUSE_WAN_STRIKING:
|
||||
zap_oseen = oseen;
|
||||
mzapmsg(mtmp, otmp, FALSE);
|
||||
otmp->spe--;
|
||||
m_using = TRUE;
|
||||
g.m_using = TRUE;
|
||||
mbhit(mtmp, rn1(8, 6), mbhitm, bhito, otmp);
|
||||
m_using = FALSE;
|
||||
g.m_using = FALSE;
|
||||
return 2;
|
||||
case MUSE_SCR_EARTH: {
|
||||
/* TODO: handle steeds */
|
||||
|
||||
+7
-6
@@ -61,7 +61,7 @@ struct monst { struct monst *dummy; }; /* lint: struct obj's union */
|
||||
cost,sdam,ldam,oc1,oc2,nut,color) { obj }
|
||||
#define None (char *) 0 /* less visual distraction for 'no description' */
|
||||
|
||||
NEARDATA struct objdescr obj_descr[] =
|
||||
NEARDATA struct objdescr obj_descr_init[] =
|
||||
#else
|
||||
/* second pass -- object definitions */
|
||||
#define BITS(nmkn,mrg,uskn,ctnr,mgc,chrg,uniq,nwsh,big,tuf,dir,sub,mtrl) \
|
||||
@@ -75,7 +75,7 @@ NEARDATA struct objdescr obj_descr[] =
|
||||
#define HARDGEM(n) (0)
|
||||
#endif
|
||||
|
||||
NEARDATA struct objclass objects[] =
|
||||
NEARDATA struct objclass obj_init[] =
|
||||
#endif
|
||||
{
|
||||
/* dummy object[0] -- description [2nd arg] *must* be NULL */
|
||||
@@ -1169,13 +1169,14 @@ OBJECT(OBJ(None, None),
|
||||
/* clang-format on */
|
||||
/* *INDENT-ON* */
|
||||
|
||||
void NDECL(objects_init);
|
||||
struct objdescr obj_descr[SIZE(obj_descr_init)];
|
||||
struct objclass objects[SIZE(obj_init)];
|
||||
|
||||
/* dummy routine used to force linkage */
|
||||
void
|
||||
objects_init()
|
||||
objects_globals_init()
|
||||
{
|
||||
return;
|
||||
memcpy(obj_descr, obj_descr_init, sizeof(obj_descr));
|
||||
memcpy(objects, obj_init, sizeof(objects));
|
||||
}
|
||||
|
||||
#endif /* !OBJECTS_PASS_2_ */
|
||||
|
||||
+16
-21
@@ -211,11 +211,6 @@ struct obj *obj;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* used by distant_name() to pass extra information to xname_flags();
|
||||
it would be much cleaner if this were a parameter, but that would
|
||||
require all of the xname() and doname() calls to be modified */
|
||||
static int distantname = 0;
|
||||
|
||||
/* Give the name of an object seen at a distance. Unlike xname/doname,
|
||||
* we don't want to set dknown if it's not set already.
|
||||
*/
|
||||
@@ -234,9 +229,9 @@ char *FDECL((*func), (OBJ_P));
|
||||
* object is within X-ray radius and only treat it as distant when
|
||||
* beyond that radius. Logic is iffy but result might be interesting.
|
||||
*/
|
||||
++distantname;
|
||||
++g.distantname;
|
||||
str = (*func)(obj);
|
||||
--distantname;
|
||||
--g.distantname;
|
||||
return str;
|
||||
}
|
||||
|
||||
@@ -426,7 +421,7 @@ unsigned cxn_flags; /* bitmask of CXN_xxx values */
|
||||
*/
|
||||
if (!nn && ocl->oc_uses_known && ocl->oc_unique)
|
||||
obj->known = 0;
|
||||
if (!Blind && !distantname)
|
||||
if (!Blind && !g.distantname)
|
||||
obj->dknown = TRUE;
|
||||
if (Role_if(PM_PRIEST))
|
||||
obj->bknown = TRUE;
|
||||
@@ -1203,7 +1198,7 @@ unsigned doname_flags;
|
||||
}
|
||||
/* treat 'restoring' like suppress_price because shopkeeper and
|
||||
bill might not be available yet while restore is in progress */
|
||||
if (!iflags.suppress_price && !restoring && is_unpaid(obj)) {
|
||||
if (!iflags.suppress_price && !g.restoring && is_unpaid(obj)) {
|
||||
long quotedprice = unpaid_cost(obj, TRUE);
|
||||
|
||||
Sprintf(eos(bp), " (%s, %ld %s)",
|
||||
@@ -3385,21 +3380,21 @@ retry:
|
||||
} else if (!strcmpi(bp, "looking glass")) {
|
||||
; /* avoid false hit on "* glass" */
|
||||
} else if (!BSTRCMPI(bp, p - 6, " glass") || !strcmpi(bp, "glass")) {
|
||||
register char *g = bp;
|
||||
register char *s = bp;
|
||||
|
||||
/* treat "broken glass" as a non-existent item; since "broken" is
|
||||
also a chest/box prefix it might have been stripped off above */
|
||||
if (broken || strstri(g, "broken"))
|
||||
if (broken || strstri(s, "broken"))
|
||||
return (struct obj *) 0;
|
||||
if (!strncmpi(g, "worthless ", 10))
|
||||
g += 10;
|
||||
if (!strncmpi(g, "piece of ", 9))
|
||||
g += 9;
|
||||
if (!strncmpi(g, "colored ", 8))
|
||||
g += 8;
|
||||
else if (!strncmpi(g, "coloured ", 9))
|
||||
g += 9;
|
||||
if (!strcmpi(g, "glass")) { /* choose random color */
|
||||
if (!strncmpi(s, "worthless ", 10))
|
||||
s += 10;
|
||||
if (!strncmpi(s, "piece of ", 9))
|
||||
s += 9;
|
||||
if (!strncmpi(s, "colored ", 8))
|
||||
s += 8;
|
||||
else if (!strncmpi(s, "coloured ", 9))
|
||||
s += 9;
|
||||
if (!strcmpi(s, "glass")) { /* choose random color */
|
||||
/* 9 different kinds */
|
||||
typ = LAST_GEM + rnd(9);
|
||||
if (objects[typ].oc_class == GEM_CLASS)
|
||||
@@ -3410,7 +3405,7 @@ retry:
|
||||
char tbuf[BUFSZ];
|
||||
|
||||
Strcpy(tbuf, "worthless piece of ");
|
||||
Strcat(tbuf, g); /* assume it starts with the color */
|
||||
Strcat(tbuf, s); /* assume it starts with the color */
|
||||
Strcpy(bp, tbuf);
|
||||
}
|
||||
}
|
||||
|
||||
+76
-82
@@ -54,12 +54,7 @@ STATIC_DCL void FDECL(tipcontainer, (struct obj *));
|
||||
/* if you can figure this out, give yourself a hearty pat on the back... */
|
||||
#define GOLD_CAPACITY(w, n) (((w) * -100L) - ((n) + 50L) - 1L)
|
||||
|
||||
/* A variable set in use_container(), to be used by the callback routines
|
||||
in_container() and out_container() from askchain() and use_container().
|
||||
Also used by menu_loot() and container_gone(). */
|
||||
static NEARDATA struct obj *current_container;
|
||||
static NEARDATA boolean abort_looting;
|
||||
#define Icebox (current_container->otyp == ICE_BOX)
|
||||
#define Icebox (g.current_container->otyp == ICE_BOX)
|
||||
|
||||
static const char
|
||||
moderateloadmsg[] = "You have a little trouble lifting",
|
||||
@@ -1573,10 +1568,9 @@ struct obj *otmp;
|
||||
int
|
||||
encumber_msg()
|
||||
{
|
||||
static int oldcap = UNENCUMBERED;
|
||||
int newcap = near_capacity();
|
||||
|
||||
if (oldcap < newcap) {
|
||||
if (g.oldcap < newcap) {
|
||||
switch (newcap) {
|
||||
case 1:
|
||||
Your("movements are slowed slightly because of your load.");
|
||||
@@ -1594,7 +1588,7 @@ encumber_msg()
|
||||
break;
|
||||
}
|
||||
context.botl = 1;
|
||||
} else if (oldcap > newcap) {
|
||||
} else if (g.oldcap > newcap) {
|
||||
switch (newcap) {
|
||||
case 0:
|
||||
Your("movements are now unencumbered.");
|
||||
@@ -1613,7 +1607,7 @@ encumber_msg()
|
||||
context.botl = 1;
|
||||
}
|
||||
|
||||
oldcap = newcap;
|
||||
g.oldcap = newcap;
|
||||
return newcap;
|
||||
}
|
||||
|
||||
@@ -1713,7 +1707,7 @@ int cindex, ccount; /* index of this container (1..N), number of them (N) */
|
||||
tmp = rnd(10);
|
||||
losehp(Maybe_Half_Phys(tmp), "carnivorous bag", KILLED_BY_AN);
|
||||
makeknown(BAG_OF_TRICKS);
|
||||
abort_looting = TRUE;
|
||||
g.abort_looting = TRUE;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1738,7 +1732,7 @@ doloot()
|
||||
boolean prev_loot = FALSE;
|
||||
int num_conts = 0;
|
||||
|
||||
abort_looting = FALSE;
|
||||
g.abort_looting = FALSE;
|
||||
|
||||
if (check_capacity((char *) 0)) {
|
||||
/* "Can't do that while carrying so much stuff." */
|
||||
@@ -1809,7 +1803,7 @@ doloot()
|
||||
for (i = 1; i <= n; i++) {
|
||||
cobj = pick_list[i - 1].item.a_obj;
|
||||
timepassed |= do_loot_cont(&cobj, i, n);
|
||||
if (abort_looting) {
|
||||
if (g.abort_looting) {
|
||||
/* chest trap or magic bag explosion or <esc> */
|
||||
free((genericptr_t) pick_list);
|
||||
return timepassed;
|
||||
@@ -1834,7 +1828,7 @@ doloot()
|
||||
anyfound = TRUE;
|
||||
|
||||
timepassed |= do_loot_cont(&cobj, 1, 1);
|
||||
if (abort_looting)
|
||||
if (g.abort_looting)
|
||||
/* chest trap or magic bag explosion or <esc> */
|
||||
return timepassed;
|
||||
}
|
||||
@@ -2094,17 +2088,17 @@ STATIC_PTR int
|
||||
in_container(obj)
|
||||
register struct obj *obj;
|
||||
{
|
||||
boolean floor_container = !carried(current_container);
|
||||
boolean floor_container = !carried(g.current_container);
|
||||
boolean was_unpaid = FALSE;
|
||||
char buf[BUFSZ];
|
||||
|
||||
if (!current_container) {
|
||||
if (!g.current_container) {
|
||||
impossible("<in> no current_container?");
|
||||
return 0;
|
||||
} else if (obj == uball || obj == uchain) {
|
||||
You("must be kidding.");
|
||||
return 0;
|
||||
} else if (obj == current_container) {
|
||||
} else if (obj == g.current_container) {
|
||||
pline("That would be an interesting topological exercise.");
|
||||
return 0;
|
||||
} else if (obj->owornmask & (W_ARMOR | W_ACCESSORY)) {
|
||||
@@ -2159,7 +2153,7 @@ register struct obj *obj;
|
||||
* of evaluation of the parameters is undefined.
|
||||
*/
|
||||
Strcpy(buf, the(xname(obj)));
|
||||
You("cannot fit %s into %s.", buf, the(xname(current_container)));
|
||||
You("cannot fit %s into %s.", buf, the(xname(g.current_container)));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2175,7 +2169,7 @@ register struct obj *obj;
|
||||
was_unpaid = obj->unpaid ? TRUE : FALSE;
|
||||
/* don't sell when putting the item into your own container,
|
||||
* but handle billing correctly */
|
||||
sellobj_state(current_container->no_charge
|
||||
sellobj_state(g.current_container->no_charge
|
||||
? SELL_DONTSELL : SELL_DELIBERATE);
|
||||
sellobj(obj, u.ux, u.uy);
|
||||
sellobj_state(SELL_NORMAL);
|
||||
@@ -2192,7 +2186,7 @@ register struct obj *obj;
|
||||
if (rot_alarm)
|
||||
obj->norevive = 1;
|
||||
}
|
||||
} else if (Is_mbag(current_container) && mbag_explodes(obj, 0)) {
|
||||
} else if (Is_mbag(g.current_container) && mbag_explodes(obj, 0)) {
|
||||
/* explicitly mention what item is triggering the explosion */
|
||||
pline("As you put %s inside, you are blasted by a magical explosion!",
|
||||
doname(obj));
|
||||
@@ -2200,34 +2194,34 @@ register struct obj *obj;
|
||||
if (was_unpaid)
|
||||
addtobill(obj, FALSE, FALSE, TRUE);
|
||||
obfree(obj, (struct obj *) 0);
|
||||
delete_contents(current_container);
|
||||
delete_contents(g.current_container);
|
||||
if (!floor_container)
|
||||
useup(current_container);
|
||||
else if (obj_here(current_container, u.ux, u.uy))
|
||||
useupf(current_container, current_container->quan);
|
||||
useup(g.current_container);
|
||||
else if (obj_here(g.current_container, u.ux, u.uy))
|
||||
useupf(g.current_container, g.current_container->quan);
|
||||
else
|
||||
panic("in_container: bag not found.");
|
||||
|
||||
losehp(d(6, 6), "magical explosion", KILLED_BY_AN);
|
||||
current_container = 0; /* baggone = TRUE; */
|
||||
g.current_container = 0; /* baggone = TRUE; */
|
||||
}
|
||||
|
||||
if (current_container) {
|
||||
Strcpy(buf, the(xname(current_container)));
|
||||
if (g.current_container) {
|
||||
Strcpy(buf, the(xname(g.current_container)));
|
||||
You("put %s into %s.", doname(obj), buf);
|
||||
|
||||
/* gold in container always needs to be added to credit */
|
||||
if (floor_container && obj->oclass == COIN_CLASS)
|
||||
sellobj(obj, current_container->ox, current_container->oy);
|
||||
(void) add_to_container(current_container, obj);
|
||||
current_container->owt = weight(current_container);
|
||||
sellobj(obj, g.current_container->ox, g.current_container->oy);
|
||||
(void) add_to_container(g.current_container, obj);
|
||||
g.current_container->owt = weight(g.current_container);
|
||||
}
|
||||
/* gold needs this, and freeinv() many lines above may cause
|
||||
* the encumbrance to disappear from the status, so just always
|
||||
* update status immediately.
|
||||
*/
|
||||
bot();
|
||||
return (current_container ? 1 : -1);
|
||||
return (g.current_container ? 1 : -1);
|
||||
}
|
||||
|
||||
/* askchain() filter used by in_container();
|
||||
@@ -2239,7 +2233,7 @@ int
|
||||
ck_bag(obj)
|
||||
struct obj *obj;
|
||||
{
|
||||
return (current_container && obj != current_container);
|
||||
return (g.current_container && obj != g.current_container);
|
||||
}
|
||||
|
||||
/* Returns: -1 to stop, 1 item was removed, 0 item was not removed. */
|
||||
@@ -2252,7 +2246,7 @@ register struct obj *obj;
|
||||
int res, loadlev;
|
||||
long count;
|
||||
|
||||
if (!current_container) {
|
||||
if (!g.current_container) {
|
||||
impossible("<out> no current_container?");
|
||||
return -1;
|
||||
} else if (is_gold) {
|
||||
@@ -2266,7 +2260,7 @@ register struct obj *obj;
|
||||
return -1;
|
||||
|
||||
count = obj->quan;
|
||||
if ((res = lift_object(obj, current_container, &count, FALSE)) <= 0)
|
||||
if ((res = lift_object(obj, g.current_container, &count, FALSE)) <= 0)
|
||||
return res;
|
||||
|
||||
if (obj->quan != count && obj->otyp != LOADSTONE)
|
||||
@@ -2274,15 +2268,15 @@ register struct obj *obj;
|
||||
|
||||
/* Remove the object from the list. */
|
||||
obj_extract_self(obj);
|
||||
current_container->owt = weight(current_container);
|
||||
g.current_container->owt = weight(g.current_container);
|
||||
|
||||
if (Icebox)
|
||||
removed_from_icebox(obj);
|
||||
|
||||
if (!obj->unpaid && !carried(current_container)
|
||||
&& costly_spot(current_container->ox, current_container->oy)) {
|
||||
obj->ox = current_container->ox;
|
||||
obj->oy = current_container->oy;
|
||||
if (!obj->unpaid && !carried(g.current_container)
|
||||
&& costly_spot(g.current_container->ox, g.current_container->oy)) {
|
||||
obj->ox = g.current_container->ox;
|
||||
obj->oy = g.current_container->oy;
|
||||
addtobill(obj, FALSE, FALSE, FALSE);
|
||||
}
|
||||
if (is_pick(obj))
|
||||
@@ -2409,7 +2403,7 @@ int FDECL((*fn), (OBJ_P));
|
||||
{
|
||||
/* result is only meaningful while use_container() is executing */
|
||||
return ((fn == in_container || fn == out_container)
|
||||
&& !current_container);
|
||||
&& !g.current_container);
|
||||
}
|
||||
|
||||
STATIC_OVL void
|
||||
@@ -2473,7 +2467,7 @@ boolean more_containers; /* True iff #loot multiple and this isn't last one */
|
||||
int used = 0;
|
||||
long loss;
|
||||
|
||||
abort_looting = FALSE;
|
||||
g.abort_looting = FALSE;
|
||||
emptymsg[0] = '\0';
|
||||
|
||||
if (!u_handsy())
|
||||
@@ -2496,37 +2490,37 @@ boolean more_containers; /* True iff #loot multiple and this isn't last one */
|
||||
multi_reason = "opening a container";
|
||||
nomovemsg = "";
|
||||
}
|
||||
abort_looting = TRUE;
|
||||
g.abort_looting = TRUE;
|
||||
return 1;
|
||||
}
|
||||
obj->lknown = 1;
|
||||
|
||||
current_container = obj; /* for use by in/out_container */
|
||||
g.current_container = obj; /* for use by in/out_container */
|
||||
/*
|
||||
* From here on out, all early returns go through 'containerdone:'.
|
||||
*/
|
||||
|
||||
/* check for Schroedinger's Cat */
|
||||
quantum_cat = SchroedingersBox(current_container);
|
||||
quantum_cat = SchroedingersBox(g.current_container);
|
||||
if (quantum_cat) {
|
||||
observe_quantum_cat(current_container, TRUE, TRUE);
|
||||
observe_quantum_cat(g.current_container, TRUE, TRUE);
|
||||
used = 1;
|
||||
}
|
||||
|
||||
cursed_mbag = Is_mbag(current_container)
|
||||
&& current_container->cursed
|
||||
&& Has_contents(current_container);
|
||||
cursed_mbag = Is_mbag(g.current_container)
|
||||
&& g.current_container->cursed
|
||||
&& Has_contents(g.current_container);
|
||||
if (cursed_mbag
|
||||
&& (loss = boh_loss(current_container, held)) != 0) {
|
||||
&& (loss = boh_loss(g.current_container, held)) != 0) {
|
||||
used = 1;
|
||||
You("owe %ld %s for lost merchandise.", loss, currency(loss));
|
||||
current_container->owt = weight(current_container);
|
||||
g.current_container->owt = weight(g.current_container);
|
||||
}
|
||||
inokay = (invent != 0
|
||||
&& !(invent == current_container && !current_container->nobj));
|
||||
outokay = Has_contents(current_container);
|
||||
&& !(invent == g.current_container && !g.current_container->nobj));
|
||||
outokay = Has_contents(g.current_container);
|
||||
if (!outokay) /* preformat the empty-container message */
|
||||
Sprintf(emptymsg, "%s is %sempty.", Ysimple_name2(current_container),
|
||||
Sprintf(emptymsg, "%s is %sempty.", Ysimple_name2(g.current_container),
|
||||
(quantum_cat || cursed_mbag) ? "now " : "");
|
||||
|
||||
/*
|
||||
@@ -2556,13 +2550,13 @@ boolean more_containers; /* True iff #loot multiple and this isn't last one */
|
||||
* <The/Your/Shk's container> is empty. Do what with it? [:irs nq or ?]
|
||||
*/
|
||||
for (;;) { /* repeats iff '?' or ":' gets chosen */
|
||||
outmaybe = (outokay || !current_container->cknown);
|
||||
outmaybe = (outokay || !g.current_container->cknown);
|
||||
if (!outmaybe)
|
||||
(void) safe_qbuf(qbuf, (char *) 0, " is empty. Do what with it?",
|
||||
current_container, Yname2, Ysimple_name2,
|
||||
g.current_container, Yname2, Ysimple_name2,
|
||||
"This");
|
||||
else
|
||||
(void) safe_qbuf(qbuf, "Do what with ", "?", current_container,
|
||||
(void) safe_qbuf(qbuf, "Do what with ", "?", g.current_container,
|
||||
yname, ysimple_name, "it");
|
||||
/* ask player about what to do with this container */
|
||||
if (flags.menu_style == MENU_PARTIAL
|
||||
@@ -2572,7 +2566,7 @@ boolean more_containers; /* True iff #loot multiple and this isn't last one */
|
||||
trying to do both will yield proper feedback */
|
||||
c = 'b';
|
||||
} else {
|
||||
c = in_or_out_menu(qbuf, current_container, outmaybe, inokay,
|
||||
c = in_or_out_menu(qbuf, g.current_container, outmaybe, inokay,
|
||||
(boolean) (used != 0), more_containers);
|
||||
}
|
||||
} else { /* TRADITIONAL or COMBINATION */
|
||||
@@ -2599,15 +2593,15 @@ boolean more_containers; /* True iff #loot multiple and this isn't last one */
|
||||
if (c == '?') {
|
||||
explain_container_prompt(more_containers);
|
||||
} else if (c == ':') { /* note: will set obj->cknown */
|
||||
if (!current_container->cknown)
|
||||
if (!g.current_container->cknown)
|
||||
used = 1; /* gaining info */
|
||||
container_contents(current_container, FALSE, FALSE, TRUE);
|
||||
container_contents(g.current_container, FALSE, FALSE, TRUE);
|
||||
} else
|
||||
break;
|
||||
} /* loop until something other than '?' or ':' is picked */
|
||||
|
||||
if (c == 'q')
|
||||
abort_looting = TRUE;
|
||||
g.abort_looting = TRUE;
|
||||
if (c == 'n' || c == 'q') /* [not strictly needed; falling thru works] */
|
||||
goto containerdone;
|
||||
loot_out = (c == 'o' || c == 'b' || c == 'r');
|
||||
@@ -2617,11 +2611,11 @@ boolean more_containers; /* True iff #loot multiple and this isn't last one */
|
||||
|
||||
/* out-only or out before in */
|
||||
if (loot_out && !loot_in_first) {
|
||||
if (!Has_contents(current_container)) {
|
||||
if (!Has_contents(g.current_container)) {
|
||||
pline1(emptymsg); /* <whatever> is empty. */
|
||||
if (!current_container->cknown)
|
||||
if (!g.current_container->cknown)
|
||||
used = 1;
|
||||
current_container->cknown = 1;
|
||||
g.current_container->cknown = 1;
|
||||
} else {
|
||||
add_valid_menu_class(0); /* reset */
|
||||
if (flags.menu_style == MENU_TRADITIONAL)
|
||||
@@ -2633,7 +2627,7 @@ boolean more_containers; /* True iff #loot multiple and this isn't last one */
|
||||
}
|
||||
|
||||
if ((loot_in || stash_one)
|
||||
&& (!invent || (invent == current_container && !invent->nobj))) {
|
||||
&& (!invent || (invent == g.current_container && !invent->nobj))) {
|
||||
You("don't have anything%s to %s.", invent ? " else" : "",
|
||||
stash_one ? "stash" : "put in");
|
||||
loot_in = stash_one = FALSE;
|
||||
@@ -2663,16 +2657,16 @@ boolean more_containers; /* True iff #loot multiple and this isn't last one */
|
||||
}
|
||||
}
|
||||
/* putting something in might have triggered magic bag explosion */
|
||||
if (!current_container)
|
||||
if (!g.current_container)
|
||||
loot_out = FALSE;
|
||||
|
||||
/* out after in */
|
||||
if (loot_out && loot_in_first) {
|
||||
if (!Has_contents(current_container)) {
|
||||
if (!Has_contents(g.current_container)) {
|
||||
pline1(emptymsg); /* <whatever> is empty. */
|
||||
if (!current_container->cknown)
|
||||
if (!g.current_container->cknown)
|
||||
used = 1;
|
||||
current_container->cknown = 1;
|
||||
g.current_container->cknown = 1;
|
||||
} else {
|
||||
add_valid_menu_class(0); /* reset */
|
||||
if (flags.menu_style == MENU_TRADITIONAL)
|
||||
@@ -2689,16 +2683,16 @@ containerdone:
|
||||
whatever was already inside, now we suddenly do. That can't
|
||||
be helped unless we want to track things item by item and then
|
||||
deal with containers whose contents are "partly known". */
|
||||
if (current_container)
|
||||
current_container->cknown = 1;
|
||||
if (g.current_container)
|
||||
g.current_container->cknown = 1;
|
||||
update_inventory();
|
||||
}
|
||||
|
||||
*objp = current_container; /* might have become null */
|
||||
if (current_container)
|
||||
current_container = 0; /* avoid hanging on to stale pointer */
|
||||
*objp = g.current_container; /* might have become null */
|
||||
if (g.current_container)
|
||||
g.current_container = 0; /* avoid hanging on to stale pointer */
|
||||
else
|
||||
abort_looting = TRUE;
|
||||
g.abort_looting = TRUE;
|
||||
return used;
|
||||
}
|
||||
|
||||
@@ -2721,7 +2715,7 @@ boolean put_in;
|
||||
checkfunc = ck_bag;
|
||||
} else {
|
||||
action = "take out";
|
||||
objlist = &(current_container->cobj);
|
||||
objlist = &(g.current_container->cobj);
|
||||
actionfunc = out_container;
|
||||
checkfunc = (int FDECL((*), (OBJ_P))) 0;
|
||||
}
|
||||
@@ -2758,7 +2752,7 @@ boolean put_in;
|
||||
all_categories = FALSE;
|
||||
Sprintf(buf, "%s what type of objects?", action);
|
||||
mflags = (ALL_TYPES | UNPAID_TYPES | BUCX_TYPES | CHOOSE_ALL);
|
||||
n = query_category(buf, put_in ? invent : current_container->cobj,
|
||||
n = query_category(buf, put_in ? invent : g.current_container->cobj,
|
||||
mflags, &pick_list, PICK_ANY);
|
||||
if (!n)
|
||||
return 0;
|
||||
@@ -2775,8 +2769,8 @@ boolean put_in;
|
||||
|
||||
if (loot_everything) {
|
||||
if (!put_in) {
|
||||
current_container->cknown = 1;
|
||||
for (otmp = current_container->cobj; otmp; otmp = otmp2) {
|
||||
g.current_container->cknown = 1;
|
||||
for (otmp = g.current_container->cobj; otmp; otmp = otmp2) {
|
||||
otmp2 = otmp->nobj;
|
||||
res = out_container(otmp);
|
||||
if (res < 0)
|
||||
@@ -2784,7 +2778,7 @@ boolean put_in;
|
||||
n_looted += res;
|
||||
}
|
||||
} else {
|
||||
for (otmp = invent; otmp && current_container; otmp = otmp2) {
|
||||
for (otmp = invent; otmp && g.current_container; otmp = otmp2) {
|
||||
otmp2 = otmp->nobj;
|
||||
res = in_container(otmp);
|
||||
if (res < 0)
|
||||
@@ -2797,9 +2791,9 @@ boolean put_in;
|
||||
if (put_in && flags.invlet_constant)
|
||||
mflags |= USE_INVLET;
|
||||
if (!put_in)
|
||||
current_container->cknown = 1;
|
||||
g.current_container->cknown = 1;
|
||||
Sprintf(buf, "%s what?", action);
|
||||
n = query_objlist(buf, put_in ? &invent : &(current_container->cobj),
|
||||
n = query_objlist(buf, put_in ? &invent : &(g.current_container->cobj),
|
||||
mflags, &pick_list, PICK_ANY,
|
||||
all_categories ? allow_all : allow_category);
|
||||
if (n) {
|
||||
@@ -2813,7 +2807,7 @@ boolean put_in;
|
||||
}
|
||||
res = put_in ? in_container(otmp) : out_container(otmp);
|
||||
if (res < 0) {
|
||||
if (!current_container) {
|
||||
if (!g.current_container) {
|
||||
/* otmp caused current_container to explode;
|
||||
both are now gone */
|
||||
otmp = 0; /* and break loop */
|
||||
|
||||
+16
-22
@@ -6,18 +6,12 @@
|
||||
#define NEED_VARARGS /* Uses ... */ /* comment line for pre-compiled headers */
|
||||
#include "hack.h"
|
||||
|
||||
static unsigned pline_flags = 0;
|
||||
static char prevmsg[BUFSZ];
|
||||
|
||||
static char *FDECL(You_buf, (int));
|
||||
#if defined(MSGHANDLER) && (defined(POSIX_TYPES) || defined(__GNUC__))
|
||||
static void FDECL(execplinehandler, (const char *));
|
||||
#endif
|
||||
|
||||
#ifdef DUMPLOG
|
||||
/* also used in end.c */
|
||||
unsigned saved_pline_index = 0; /* slot in saved_plines[] to use next */
|
||||
char *saved_plines[DUMPLOG_MSG_COUNT] = { (char *) 0 };
|
||||
|
||||
/* keep the most recent DUMPLOG_MSG_COUNT messages */
|
||||
void
|
||||
@@ -31,8 +25,8 @@ const char *line;
|
||||
* The core should take responsibility for that and have
|
||||
* this share it.
|
||||
*/
|
||||
unsigned indx = saved_pline_index; /* next slot to use */
|
||||
char *oldest = saved_plines[indx]; /* current content of that slot */
|
||||
unsigned indx = g.saved_pline_index; /* next slot to use */
|
||||
char *oldest = g.saved_plines[indx]; /* current content of that slot */
|
||||
|
||||
if (oldest && strlen(oldest) >= strlen(line)) {
|
||||
/* this buffer will gradually shrink until the 'else' is needed;
|
||||
@@ -41,9 +35,9 @@ const char *line;
|
||||
} else {
|
||||
if (oldest)
|
||||
free((genericptr_t) oldest);
|
||||
saved_plines[indx] = dupstr(line);
|
||||
g.saved_plines[indx] = dupstr(line);
|
||||
}
|
||||
saved_pline_index = (indx + 1) % DUMPLOG_MSG_COUNT;
|
||||
g.saved_pline_index = (indx + 1) % DUMPLOG_MSG_COUNT;
|
||||
}
|
||||
|
||||
/* called during save (unlike the interface-specific message history,
|
||||
@@ -55,9 +49,9 @@ dumplogfreemessages()
|
||||
unsigned indx;
|
||||
|
||||
for (indx = 0; indx < DUMPLOG_MSG_COUNT; ++indx)
|
||||
if (saved_plines[indx])
|
||||
free((genericptr_t) saved_plines[indx]), saved_plines[indx] = 0;
|
||||
saved_pline_index = 0;
|
||||
if (g.saved_plines[indx])
|
||||
free((genericptr_t) g.saved_plines[indx]), g.saved_plines[indx] = 0;
|
||||
g.saved_pline_index = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -139,7 +133,7 @@ VA_DECL(const char *, line)
|
||||
* Unfortunately, that means Norep() isn't honored (general issue) and
|
||||
* that short lines aren't combined into one longer one (tty behavior).
|
||||
*/
|
||||
if ((pline_flags & SUPPRESS_HISTORY) == 0)
|
||||
if ((g.pline_flags & SUPPRESS_HISTORY) == 0)
|
||||
dumplogmsg(line);
|
||||
#endif
|
||||
/* use raw_print() if we're called too early (or perhaps too late
|
||||
@@ -153,11 +147,11 @@ VA_DECL(const char *, line)
|
||||
}
|
||||
|
||||
msgtyp = MSGTYP_NORMAL;
|
||||
no_repeat = (pline_flags & PLINE_NOREPEAT) ? TRUE : FALSE;
|
||||
if ((pline_flags & OVERRIDE_MSGTYPE) == 0) {
|
||||
no_repeat = (g.pline_flags & PLINE_NOREPEAT) ? TRUE : FALSE;
|
||||
if ((g.pline_flags & OVERRIDE_MSGTYPE) == 0) {
|
||||
msgtyp = msgtype_type(line, no_repeat);
|
||||
if (msgtyp == MSGTYP_NOSHOW
|
||||
|| (msgtyp == MSGTYP_NOREP && !strcmp(line, prevmsg)))
|
||||
|| (msgtyp == MSGTYP_NOREP && !strcmp(line, g.prevmsg)))
|
||||
/* FIXME: we need a way to tell our caller that this message
|
||||
* was suppressed so that caller doesn't set iflags.last_msg
|
||||
* for something that hasn't been shown, otherwise a subsequent
|
||||
@@ -181,7 +175,7 @@ VA_DECL(const char *, line)
|
||||
|
||||
/* this gets cleared after every pline message */
|
||||
iflags.last_msg = PLNMSG_UNKNOWN;
|
||||
(void) strncpy(prevmsg, line, BUFSZ), prevmsg[BUFSZ - 1] = '\0';
|
||||
(void) strncpy(g.prevmsg, line, BUFSZ), g.prevmsg[BUFSZ - 1] = '\0';
|
||||
if (msgtyp == MSGTYP_STOP)
|
||||
display_nhwindow(WIN_MESSAGE, TRUE); /* --more-- */
|
||||
|
||||
@@ -205,9 +199,9 @@ VA_DECL2(unsigned, pflags, const char *, line)
|
||||
{
|
||||
VA_START(line);
|
||||
VA_INIT(line, const char *);
|
||||
pline_flags = pflags;
|
||||
g.pline_flags = pflags;
|
||||
vpline(line, VA_ARGS);
|
||||
pline_flags = 0;
|
||||
g.pline_flags = 0;
|
||||
VA_END();
|
||||
return;
|
||||
}
|
||||
@@ -218,9 +212,9 @@ VA_DECL(const char *, line)
|
||||
{
|
||||
VA_START(line);
|
||||
VA_INIT(line, const char *);
|
||||
pline_flags = PLINE_NOREPEAT;
|
||||
g.pline_flags = PLINE_NOREPEAT;
|
||||
vpline(line, VA_ARGS);
|
||||
pline_flags = 0;
|
||||
g.pline_flags = 0;
|
||||
VA_END();
|
||||
return;
|
||||
}
|
||||
|
||||
+4
-8
@@ -33,10 +33,6 @@ STATIC_DCL void NDECL(polysense);
|
||||
STATIC_VAR const char no_longer_petrify_resistant[] =
|
||||
"No longer petrify-resistant, you";
|
||||
|
||||
/* controls whether taking on new form or becoming new man can also
|
||||
change sex (ought to be an arg to polymon() and newman() instead) */
|
||||
STATIC_VAR int sex_change_ok = 0;
|
||||
|
||||
/* update the youmonst.data structure pointer and intrinsics */
|
||||
void
|
||||
set_uasmon()
|
||||
@@ -296,7 +292,7 @@ newman()
|
||||
u.ulevelmax = newlvl;
|
||||
u.ulevel = newlvl;
|
||||
|
||||
if (sex_change_ok && !rn2(10))
|
||||
if (g.sex_change_ok && !rn2(10))
|
||||
change_sex();
|
||||
|
||||
adjabil(oldlvl, (int) u.ulevel);
|
||||
@@ -573,14 +569,14 @@ int psflags;
|
||||
/* The below polyok() fails either if everything is genocided, or if
|
||||
* we deliberately chose something illegal to force newman().
|
||||
*/
|
||||
sex_change_ok++;
|
||||
g.sex_change_ok++;
|
||||
if (!polyok(&mons[mntmp]) || (!forcecontrol && !rn2(5))
|
||||
|| your_race(&mons[mntmp])) {
|
||||
newman();
|
||||
} else {
|
||||
(void) polymon(mntmp);
|
||||
}
|
||||
sex_change_ok--; /* reset */
|
||||
g.sex_change_ok--; /* reset */
|
||||
|
||||
made_change:
|
||||
new_light = emits_light(youmonst.data);
|
||||
@@ -650,7 +646,7 @@ int mntmp;
|
||||
if (!flags.female)
|
||||
dochange = TRUE;
|
||||
} else if (!is_neuter(&mons[mntmp]) && mntmp != u.ulycn) {
|
||||
if (sex_change_ok && !rn2(10))
|
||||
if (g.sex_change_ok && !rn2(10))
|
||||
dochange = TRUE;
|
||||
}
|
||||
|
||||
|
||||
+29
-32
@@ -5,9 +5,6 @@
|
||||
|
||||
#include "hack.h"
|
||||
|
||||
boolean notonhead = FALSE;
|
||||
|
||||
static NEARDATA int nothing, unkn;
|
||||
static NEARDATA const char beverages[] = { POTION_CLASS, 0 };
|
||||
|
||||
STATIC_DCL long FDECL(itimeout, (long));
|
||||
@@ -548,17 +545,17 @@ register struct obj *otmp;
|
||||
int retval;
|
||||
|
||||
otmp->in_use = TRUE;
|
||||
nothing = unkn = 0;
|
||||
g.potion_nothing = g.potion_unkn = 0;
|
||||
if ((retval = peffects(otmp)) >= 0)
|
||||
return retval;
|
||||
|
||||
if (nothing) {
|
||||
unkn++;
|
||||
if (g.potion_nothing) {
|
||||
g.potion_unkn++;
|
||||
You("have a %s feeling for a moment, then it passes.",
|
||||
Hallucination ? "normal" : "peculiar");
|
||||
}
|
||||
if (otmp->dknown && !objects[otmp->otyp].oc_name_known) {
|
||||
if (!unkn) {
|
||||
if (!g.potion_unkn) {
|
||||
makeknown(otmp->otyp);
|
||||
more_experienced(0, 10);
|
||||
} else if (!objects[otmp->otyp].oc_uname)
|
||||
@@ -577,7 +574,7 @@ register struct obj *otmp;
|
||||
switch (otmp->otyp) {
|
||||
case POT_RESTORE_ABILITY:
|
||||
case SPE_RESTORE_ABILITY:
|
||||
unkn++;
|
||||
g.potion_unkn++;
|
||||
if (otmp->cursed) {
|
||||
pline("Ulch! This makes you feel mediocre!");
|
||||
break;
|
||||
@@ -617,7 +614,7 @@ register struct obj *otmp;
|
||||
break;
|
||||
case POT_HALLUCINATION:
|
||||
if (Hallucination || Halluc_resistance)
|
||||
nothing++;
|
||||
g.potion_nothing++;
|
||||
(void) make_hallucinated(itimeout_incr(HHallucination,
|
||||
rn1(200, 600 - 300 * bcsign(otmp))),
|
||||
TRUE, 0L);
|
||||
@@ -629,7 +626,7 @@ register struct obj *otmp;
|
||||
newuhs(FALSE);
|
||||
break;
|
||||
}
|
||||
unkn++;
|
||||
g.potion_unkn++;
|
||||
if (is_undead(youmonst.data) || is_demon(youmonst.data)
|
||||
|| u.ualign.type == A_CHAOTIC) {
|
||||
if (otmp->blessed) {
|
||||
@@ -674,7 +671,7 @@ register struct obj *otmp;
|
||||
}
|
||||
break;
|
||||
case POT_BOOZE:
|
||||
unkn++;
|
||||
g.potion_unkn++;
|
||||
pline("Ooph! This tastes like %s%s!",
|
||||
otmp->odiluted ? "watered down " : "",
|
||||
Hallucination ? "dandelion wine" : "liquid fire");
|
||||
@@ -694,7 +691,7 @@ register struct obj *otmp;
|
||||
break;
|
||||
case POT_ENLIGHTENMENT:
|
||||
if (otmp->cursed) {
|
||||
unkn++;
|
||||
g.potion_unkn++;
|
||||
You("have an uneasy feeling...");
|
||||
exercise(A_WIS, FALSE);
|
||||
} else {
|
||||
@@ -718,7 +715,7 @@ register struct obj *otmp;
|
||||
/* FALLTHRU */
|
||||
case POT_INVISIBILITY:
|
||||
if (Invis || Blind || BInvis) {
|
||||
nothing++;
|
||||
g.potion_nothing++;
|
||||
} else {
|
||||
self_invis_message();
|
||||
}
|
||||
@@ -736,7 +733,7 @@ register struct obj *otmp;
|
||||
case POT_FRUIT_JUICE: {
|
||||
int msg = Invisible && !Blind;
|
||||
|
||||
unkn++;
|
||||
g.potion_unkn++;
|
||||
if (otmp->cursed)
|
||||
pline("Yecch! This tastes %s.",
|
||||
Hallucination ? "overripe" : "rotten");
|
||||
@@ -766,7 +763,7 @@ register struct obj *otmp;
|
||||
newsym(u.ux, u.uy); /* see yourself! */
|
||||
if (msg && !Blind) { /* Blind possible if polymorphed */
|
||||
You("can see through yourself, but you are visible!");
|
||||
unkn--;
|
||||
g.potion_unkn--;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -801,8 +798,8 @@ register struct obj *otmp;
|
||||
int x, y;
|
||||
|
||||
if (Detect_monsters)
|
||||
nothing++;
|
||||
unkn++;
|
||||
g.potion_nothing++;
|
||||
g.potion_unkn++;
|
||||
/* after a while, repeated uses become less effective */
|
||||
if ((HDetect_monsters & TIMEOUT) >= 300L)
|
||||
i = 1;
|
||||
@@ -816,11 +813,11 @@ register struct obj *otmp;
|
||||
newsym(x, y);
|
||||
}
|
||||
if (MON_AT(x, y))
|
||||
unkn = 0;
|
||||
g.potion_unkn = 0;
|
||||
}
|
||||
}
|
||||
see_monsters();
|
||||
if (unkn)
|
||||
if (g.potion_unkn)
|
||||
You_feel("lonely.");
|
||||
break;
|
||||
}
|
||||
@@ -885,11 +882,11 @@ register struct obj *otmp;
|
||||
if (!Confusion) {
|
||||
if (Hallucination) {
|
||||
pline("What a trippy feeling!");
|
||||
unkn++;
|
||||
g.potion_unkn++;
|
||||
} else
|
||||
pline("Huh, What? Where am I?");
|
||||
} else
|
||||
nothing++;
|
||||
g.potion_nothing++;
|
||||
make_confused(itimeout_incr(HConfusion,
|
||||
rn1(7, 16 - 8 * bcsign(otmp))),
|
||||
FALSE);
|
||||
@@ -897,9 +894,9 @@ register struct obj *otmp;
|
||||
case POT_GAIN_ABILITY:
|
||||
if (otmp->cursed) {
|
||||
pline("Ulch! That potion tasted foul!");
|
||||
unkn++;
|
||||
g.potion_unkn++;
|
||||
} else if (Fixed_abil) {
|
||||
nothing++;
|
||||
g.potion_nothing++;
|
||||
} else { /* If blessed, increase all; if not, try up to */
|
||||
int itmp; /* 6 times to find one which can be increased. */
|
||||
|
||||
@@ -918,7 +915,7 @@ register struct obj *otmp;
|
||||
/* skip when mounted; heal_legs() would heal steed's legs */
|
||||
if (Wounded_legs && !otmp->cursed && !u.usteed) {
|
||||
heal_legs(0);
|
||||
unkn++;
|
||||
g.potion_unkn++;
|
||||
break;
|
||||
}
|
||||
/* FALLTHRU */
|
||||
@@ -927,21 +924,21 @@ register struct obj *otmp;
|
||||
You("are suddenly moving %sfaster.", Fast ? "" : "much ");
|
||||
} else {
|
||||
Your("%s get new energy.", makeplural(body_part(LEG)));
|
||||
unkn++;
|
||||
g.potion_unkn++;
|
||||
}
|
||||
exercise(A_DEX, TRUE);
|
||||
incr_itimeout(&HFast, rn1(10, 100 + 60 * bcsign(otmp)));
|
||||
break;
|
||||
case POT_BLINDNESS:
|
||||
if (Blind)
|
||||
nothing++;
|
||||
g.potion_nothing++;
|
||||
make_blinded(itimeout_incr(Blinded,
|
||||
rn1(200, 250 - 125 * bcsign(otmp))),
|
||||
(boolean) !Blind);
|
||||
break;
|
||||
case POT_GAIN_LEVEL:
|
||||
if (otmp->cursed) {
|
||||
unkn++;
|
||||
g.potion_unkn++;
|
||||
/* they went up a level */
|
||||
if ((ledger_no(&u.uz) == 1 && u.uhave.amulet)
|
||||
|| Can_rise_up(u.ux, u.uy, &u.uz)) {
|
||||
@@ -1019,7 +1016,7 @@ register struct obj *otmp;
|
||||
that cursed effect yields "you float down" on next turn.
|
||||
Blessed and uncursed get one extra turn duration. */
|
||||
} else /* already levitating, or can't levitate */
|
||||
nothing++;
|
||||
g.potion_nothing++;
|
||||
|
||||
if (otmp->cursed) {
|
||||
/* 'already levitating' used to block the cursed effect(s)
|
||||
@@ -1034,7 +1031,7 @@ register struct obj *otmp;
|
||||
(void) doup();
|
||||
/* in case we're already Levitating, which would have
|
||||
resulted in incrementing 'nothing' */
|
||||
nothing = 0; /* not nothing after all */
|
||||
g.potion_nothing = 0; /* not nothing after all */
|
||||
} else if (has_ceiling(&u.uz)) {
|
||||
int dmg = rnd(!uarmh ? 10 : !is_metallic(uarmh) ? 6 : 3);
|
||||
|
||||
@@ -1042,7 +1039,7 @@ register struct obj *otmp;
|
||||
ceiling(u.ux, u.uy));
|
||||
losehp(Maybe_Half_Phys(dmg), "colliding with the ceiling",
|
||||
KILLED_BY);
|
||||
nothing = 0; /* not nothing after all */
|
||||
g.potion_nothing = 0; /* not nothing after all */
|
||||
}
|
||||
} else if (otmp->blessed) {
|
||||
/* at this point, timeout is already at least 1 */
|
||||
@@ -1126,7 +1123,7 @@ register struct obj *otmp;
|
||||
}
|
||||
if (Stoned)
|
||||
fix_petrification();
|
||||
unkn++; /* holy/unholy water can burn like acid too */
|
||||
g.potion_unkn++; /* holy/unholy water can burn like acid too */
|
||||
break;
|
||||
case POT_POLYMORPH:
|
||||
You_feel("a little %s.", Hallucination ? "normal" : "strange");
|
||||
@@ -1325,7 +1322,7 @@ int how;
|
||||
FALSE)));
|
||||
} else if (has_head(mon->data)) {
|
||||
Sprintf(buf, "%s %s", s_suffix(mnam),
|
||||
(notonhead ? "body" : "head"));
|
||||
(g.notonhead ? "body" : "head"));
|
||||
} else {
|
||||
Strcpy(buf, mnam);
|
||||
}
|
||||
|
||||
+5
-5
@@ -282,7 +282,7 @@ char who, /* 'd' => deity, 'l' => leader, 'n' => nemesis, 'o' => artifact */
|
||||
which; /* 'h'|'H'|'i'|'I'|'j'|'J' */
|
||||
{
|
||||
const char *pnoun;
|
||||
int g;
|
||||
int godgend;
|
||||
char lwhich = lowc(which); /* H,I,J -> h,i,j */
|
||||
|
||||
/*
|
||||
@@ -298,13 +298,13 @@ char who, /* 'd' => deity, 'l' => leader, 'n' => nemesis, 'o' => artifact */
|
||||
: (lwhich == 'i') ? "them"
|
||||
: (lwhich == 'j') ? "their" : "?";
|
||||
} else {
|
||||
g = (who == 'd') ? quest_status.godgend
|
||||
godgend = (who == 'd') ? quest_status.godgend
|
||||
: (who == 'l') ? quest_status.ldrgend
|
||||
: (who == 'n') ? quest_status.nemgend
|
||||
: 2; /* default to neuter */
|
||||
pnoun = (lwhich == 'h') ? genders[g].he
|
||||
: (lwhich == 'i') ? genders[g].him
|
||||
: (lwhich == 'j') ? genders[g].his : "?";
|
||||
pnoun = (lwhich == 'h') ? genders[godgend].he
|
||||
: (lwhich == 'i') ? genders[godgend].him
|
||||
: (lwhich == 'j') ? genders[godgend].his : "?";
|
||||
}
|
||||
Strcpy(cvt_buf, pnoun);
|
||||
/* capitalize for H,I,J */
|
||||
|
||||
+18
-20
@@ -12,8 +12,6 @@
|
||||
((mndx) == urace.malenum \
|
||||
|| (urace.femalenum != NON_PM && (mndx) == urace.femalenum))
|
||||
|
||||
boolean known;
|
||||
|
||||
static NEARDATA const char readable[] = { ALL_CLASSES, SCROLL_CLASS,
|
||||
SPBOOK_CLASS, 0 };
|
||||
static const char all_count[] = { ALLOW_COUNT, ALL_CLASSES, 0 };
|
||||
@@ -189,7 +187,7 @@ doread()
|
||||
register struct obj *scroll;
|
||||
boolean confused, nodisappear;
|
||||
|
||||
known = FALSE;
|
||||
g.known = FALSE;
|
||||
if (check_capacity((char *) 0))
|
||||
return 0;
|
||||
scroll = getobj(readable, "read");
|
||||
@@ -396,7 +394,7 @@ doread()
|
||||
}
|
||||
if (!seffects(scroll)) {
|
||||
if (!objects[scroll->otyp].oc_name_known) {
|
||||
if (known)
|
||||
if (g.known)
|
||||
learnscroll(scroll);
|
||||
else if (!objects[scroll->otyp].oc_uname)
|
||||
docall(scroll);
|
||||
@@ -801,7 +799,7 @@ int howmuch;
|
||||
if (Sokoban)
|
||||
return;
|
||||
|
||||
known = TRUE;
|
||||
g.known = TRUE;
|
||||
for (zx = 0; zx < COLNO; zx++)
|
||||
for (zy = 0; zy < ROWNO; zy++)
|
||||
if (howmuch & ALL_MAP || rn2(7)) {
|
||||
@@ -1013,7 +1011,7 @@ struct obj *sobj; /* scroll, or fake spellbook object for scroll-like spell */
|
||||
switch (otyp) {
|
||||
#ifdef MAIL
|
||||
case SCR_MAIL:
|
||||
known = TRUE;
|
||||
g.known = TRUE;
|
||||
if (sobj->spe == 2)
|
||||
/* "stamped scroll" created via magic marker--without a stamp */
|
||||
pline("This scroll is marked \"postage due\".");
|
||||
@@ -1142,7 +1140,7 @@ struct obj *sobj; /* scroll, or fake spellbook object for scroll-like spell */
|
||||
if (s) {
|
||||
otmp->spe += s;
|
||||
adj_abon(otmp, s);
|
||||
known = otmp->known;
|
||||
g.known = otmp->known;
|
||||
/* update shop bill to reflect new higher price */
|
||||
if (s > 0 && otmp->unpaid)
|
||||
alter_cost(otmp, 0L);
|
||||
@@ -1184,7 +1182,7 @@ struct obj *sobj; /* scroll, or fake spellbook object for scroll-like spell */
|
||||
exercise(A_CON, FALSE);
|
||||
break;
|
||||
} else
|
||||
known = TRUE;
|
||||
g.known = TRUE;
|
||||
} else { /* armor and scroll both cursed */
|
||||
pline("%s.", Yobjnam2(otmp, "vibrate"));
|
||||
if (otmp->spe >= -6) {
|
||||
@@ -1264,7 +1262,7 @@ struct obj *sobj; /* scroll, or fake spellbook object for scroll-like spell */
|
||||
You("don't remember there being any magic words on this scroll.");
|
||||
else
|
||||
pline("This scroll seems to be blank.");
|
||||
known = TRUE;
|
||||
g.known = TRUE;
|
||||
break;
|
||||
case SCR_REMOVE_CURSE:
|
||||
case SPE_REMOVE_CURSE: {
|
||||
@@ -1350,7 +1348,7 @@ struct obj *sobj; /* scroll, or fake spellbook object for scroll-like spell */
|
||||
confused ? &mons[PM_ACID_BLOB]
|
||||
: (struct permonst *) 0,
|
||||
FALSE))
|
||||
known = TRUE;
|
||||
g.known = TRUE;
|
||||
/* no need to flush monsters; we ask for identification only if the
|
||||
* monsters are not visible
|
||||
*/
|
||||
@@ -1430,14 +1428,14 @@ struct obj *sobj; /* scroll, or fake spellbook object for scroll-like spell */
|
||||
vis_results ? "is" : "seems",
|
||||
(results < 0) ? "un" : "");
|
||||
if (vis_results > 0)
|
||||
known = TRUE;
|
||||
g.known = TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SCR_GENOCIDE:
|
||||
if (!already_known)
|
||||
You("have found a scroll of genocide!");
|
||||
known = TRUE;
|
||||
g.known = TRUE;
|
||||
if (sblessed)
|
||||
do_class_genocide();
|
||||
else
|
||||
@@ -1446,11 +1444,11 @@ struct obj *sobj; /* scroll, or fake spellbook object for scroll-like spell */
|
||||
case SCR_LIGHT:
|
||||
if (!confused || rn2(5)) {
|
||||
if (!Blind)
|
||||
known = TRUE;
|
||||
g.known = TRUE;
|
||||
litroom(!confused && !scursed, sobj);
|
||||
if (!confused && !scursed) {
|
||||
if (lightdamage(sobj, TRUE, 5))
|
||||
known = TRUE;
|
||||
g.known = TRUE;
|
||||
}
|
||||
} else {
|
||||
/* could be scroll of create monster, don't set known ...*/
|
||||
@@ -1463,7 +1461,7 @@ struct obj *sobj; /* scroll, or fake spellbook object for scroll-like spell */
|
||||
if (confused || scursed) {
|
||||
level_tele();
|
||||
} else {
|
||||
known = scrolltele(sobj);
|
||||
g.known = scrolltele(sobj);
|
||||
}
|
||||
break;
|
||||
case SCR_GOLD_DETECTION:
|
||||
@@ -1556,7 +1554,7 @@ struct obj *sobj; /* scroll, or fake spellbook object for scroll-like spell */
|
||||
cvt_sdoor_to_door(&levl[x][y]);
|
||||
/* do_mapping() already reveals secret passages */
|
||||
}
|
||||
known = TRUE;
|
||||
g.known = TRUE;
|
||||
/*FALLTHRU*/
|
||||
case SPE_MAGIC_MAPPING:
|
||||
if (level.flags.nommap) {
|
||||
@@ -1576,7 +1574,7 @@ struct obj *sobj; /* scroll, or fake spellbook object for scroll-like spell */
|
||||
}
|
||||
break;
|
||||
case SCR_AMNESIA:
|
||||
known = TRUE;
|
||||
g.known = TRUE;
|
||||
forget((!sblessed ? ALL_SPELLS : 0)
|
||||
| (!confused || scursed ? ALL_MAP : 0));
|
||||
if (Hallucination) /* Ommmmmm! */
|
||||
@@ -1657,7 +1655,7 @@ struct obj *sobj; /* scroll, or fake spellbook object for scroll-like spell */
|
||||
else
|
||||
pline_The("%s rumbles %s you!", ceiling(u.ux, u.uy),
|
||||
sblessed ? "around" : "above");
|
||||
known = 1;
|
||||
g.known = 1;
|
||||
sokoban_guilt();
|
||||
|
||||
/* Loop through the surrounding squares */
|
||||
@@ -1682,7 +1680,7 @@ struct obj *sobj; /* scroll, or fake spellbook object for scroll-like spell */
|
||||
}
|
||||
break;
|
||||
case SCR_PUNISHMENT:
|
||||
known = TRUE;
|
||||
g.known = TRUE;
|
||||
if (confused || sblessed) {
|
||||
You_feel("guilty.");
|
||||
break;
|
||||
@@ -1694,7 +1692,7 @@ struct obj *sobj; /* scroll, or fake spellbook object for scroll-like spell */
|
||||
|
||||
if (!already_known)
|
||||
You("have found a scroll of stinking cloud!");
|
||||
known = TRUE;
|
||||
g.known = TRUE;
|
||||
pline("Where do you want to center the %scloud?",
|
||||
already_known ? "stinking " : "");
|
||||
cc.x = u.ux;
|
||||
|
||||
+25
-32
@@ -72,9 +72,6 @@ struct bucket {
|
||||
STATIC_DCL void NDECL(clear_id_mapping);
|
||||
STATIC_DCL void FDECL(add_id_mapping, (unsigned, unsigned));
|
||||
|
||||
static int n_ids_mapped = 0;
|
||||
static struct bucket *id_map = 0;
|
||||
|
||||
#ifdef AMII_GRAPHICS
|
||||
void FDECL(amii_setpens, (int)); /* use colors from save file */
|
||||
extern int amii_numcolors;
|
||||
@@ -82,10 +79,6 @@ extern int amii_numcolors;
|
||||
|
||||
#include "display.h"
|
||||
|
||||
boolean restoring = FALSE;
|
||||
static NEARDATA struct fruit *oldfruit;
|
||||
static NEARDATA long omoves;
|
||||
|
||||
#define Is_IceBox(o) ((o)->otyp == ICE_BOX ? TRUE : FALSE)
|
||||
|
||||
/* Recalculate level.objects[x][y], since this info was not saved. */
|
||||
@@ -179,7 +172,7 @@ boolean ghostly;
|
||||
|
||||
mread(fd, (genericptr_t) tmp_dam, sizeof(*tmp_dam));
|
||||
if (ghostly)
|
||||
tmp_dam->when += (monstermoves - omoves);
|
||||
tmp_dam->when += (monstermoves - g.omoves);
|
||||
Strcpy(damaged_shops,
|
||||
in_rooms(tmp_dam->place.x, tmp_dam->place.y, SHOPBASE));
|
||||
if (u.uz.dlevel) {
|
||||
@@ -293,7 +286,7 @@ boolean ghostly, frozen;
|
||||
* immediately after old player died.
|
||||
*/
|
||||
if (ghostly && !frozen && !age_is_relative(otmp))
|
||||
otmp->age = monstermoves - omoves + otmp->age;
|
||||
otmp->age = monstermoves - g.omoves + otmp->age;
|
||||
|
||||
/* get contents of a container or statue */
|
||||
if (Has_contents(otmp)) {
|
||||
@@ -513,7 +506,7 @@ register struct obj *otmp;
|
||||
{
|
||||
register struct fruit *oldf;
|
||||
|
||||
for (oldf = oldfruit; oldf; oldf = oldf->nextf)
|
||||
for (oldf = g.oldfruit; oldf; oldf = oldf->nextf)
|
||||
if (oldf->fid == otmp->spe)
|
||||
break;
|
||||
|
||||
@@ -805,7 +798,7 @@ register int fd;
|
||||
int rtmp;
|
||||
struct obj *otmp;
|
||||
|
||||
restoring = TRUE;
|
||||
g.restoring = TRUE;
|
||||
get_plname_from_file(fd, plname);
|
||||
getlev(fd, 0, (xchar) 0, FALSE);
|
||||
if (!restgamestate(fd, &stuckid, &steedid)) {
|
||||
@@ -813,7 +806,7 @@ register int fd;
|
||||
savelev(-1, 0, FREE_SAVE); /* discard current level */
|
||||
(void) nhclose(fd);
|
||||
(void) delete_savefile();
|
||||
restoring = FALSE;
|
||||
g.restoring = FALSE;
|
||||
return 0;
|
||||
}
|
||||
restlevelstate(stuckid, steedid);
|
||||
@@ -907,7 +900,7 @@ register int fd;
|
||||
#ifdef MFLOPPY
|
||||
gameDiskPrompt();
|
||||
#endif
|
||||
max_rank_sz(); /* to recompute mrank_sz (botl.c) */
|
||||
max_rank_sz(); /* to recompute g.mrank_sz (botl.c) */
|
||||
/* take care of iron ball & chain */
|
||||
for (otmp = fobj; otmp; otmp = otmp->nobj)
|
||||
if (otmp->owornmask)
|
||||
@@ -929,7 +922,7 @@ register int fd;
|
||||
|
||||
run_timers(); /* expire all timers that have gone off while away */
|
||||
docrt();
|
||||
restoring = FALSE;
|
||||
g.restoring = FALSE;
|
||||
clear_nhwindow(WIN_MESSAGE);
|
||||
|
||||
/* Success! */
|
||||
@@ -1036,7 +1029,7 @@ boolean ghostly;
|
||||
* information is available when restoring the objects.
|
||||
*/
|
||||
if (ghostly)
|
||||
oldfruit = loadfruitchn(fd);
|
||||
g.oldfruit = loadfruitchn(fd);
|
||||
|
||||
/* First some sanity checks */
|
||||
mread(fd, (genericptr_t) &hpid, sizeof(hpid));
|
||||
@@ -1063,8 +1056,8 @@ boolean ghostly;
|
||||
rest_levl(fd,
|
||||
(boolean) ((sfrestinfo.sfi1 & SFI1_RLECOMP) == SFI1_RLECOMP));
|
||||
mread(fd, (genericptr_t) lastseentyp, sizeof(lastseentyp));
|
||||
mread(fd, (genericptr_t) &omoves, sizeof(omoves));
|
||||
elapsed = monstermoves - omoves;
|
||||
mread(fd, (genericptr_t) &g.omoves, sizeof(g.omoves));
|
||||
elapsed = monstermoves - g.omoves;
|
||||
mread(fd, (genericptr_t) &upstair, sizeof(stairway));
|
||||
mread(fd, (genericptr_t) &dnstair, sizeof(stairway));
|
||||
mread(fd, (genericptr_t) &upladder, sizeof(stairway));
|
||||
@@ -1140,7 +1133,7 @@ boolean ghostly;
|
||||
rest_regions(fd, ghostly);
|
||||
if (ghostly) {
|
||||
/* Now get rid of all the temp fruits... */
|
||||
freefruitchn(oldfruit), oldfruit = 0;
|
||||
freefruitchn(g.oldfruit), g.oldfruit = 0;
|
||||
|
||||
if (lev > ledger_no(&medusa_level)
|
||||
&& lev < ledger_no(&stronghold_level) && xdnstair == 0) {
|
||||
@@ -1237,11 +1230,11 @@ clear_id_mapping()
|
||||
{
|
||||
struct bucket *curr;
|
||||
|
||||
while ((curr = id_map) != 0) {
|
||||
id_map = curr->next;
|
||||
while ((curr = g.id_map) != 0) {
|
||||
g.id_map = curr->next;
|
||||
free((genericptr_t) curr);
|
||||
}
|
||||
n_ids_mapped = 0;
|
||||
g.n_ids_mapped = 0;
|
||||
}
|
||||
|
||||
/* Add a mapping to the ID map. */
|
||||
@@ -1251,18 +1244,18 @@ unsigned gid, nid;
|
||||
{
|
||||
int idx;
|
||||
|
||||
idx = n_ids_mapped % N_PER_BUCKET;
|
||||
idx = g.n_ids_mapped % N_PER_BUCKET;
|
||||
/* idx is zero on first time through, as well as when a new bucket is */
|
||||
/* needed */
|
||||
if (idx == 0) {
|
||||
struct bucket *gnu = (struct bucket *) alloc(sizeof(struct bucket));
|
||||
gnu->next = id_map;
|
||||
id_map = gnu;
|
||||
gnu->next = g.id_map;
|
||||
g.id_map = gnu;
|
||||
}
|
||||
|
||||
id_map->map[idx].gid = gid;
|
||||
id_map->map[idx].nid = nid;
|
||||
n_ids_mapped++;
|
||||
g.id_map->map[idx].gid = gid;
|
||||
g.id_map->map[idx].nid = nid;
|
||||
g.n_ids_mapped++;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1277,11 +1270,11 @@ unsigned gid, *nidp;
|
||||
int i;
|
||||
struct bucket *curr;
|
||||
|
||||
if (n_ids_mapped)
|
||||
for (curr = id_map; curr; curr = curr->next) {
|
||||
if (g.n_ids_mapped)
|
||||
for (curr = g.id_map; curr; curr = curr->next) {
|
||||
/* first bucket might not be totally full */
|
||||
if (curr == id_map) {
|
||||
i = n_ids_mapped % N_PER_BUCKET;
|
||||
if (curr == g.id_map) {
|
||||
i = g.n_ids_mapped % N_PER_BUCKET;
|
||||
if (i == 0)
|
||||
i = N_PER_BUCKET;
|
||||
} else
|
||||
@@ -1631,7 +1624,7 @@ register unsigned int len;
|
||||
return;
|
||||
} else {
|
||||
pline("Read %d instead of %u bytes.", rlen, len);
|
||||
if (restoring) {
|
||||
if (g.restoring) {
|
||||
(void) nhclose(fd);
|
||||
(void) delete_savefile();
|
||||
error("Error restoring old game.");
|
||||
|
||||
+16
-16
@@ -769,7 +769,7 @@ const struct Align aligns[] = {
|
||||
static struct {
|
||||
boolean roles[SIZE(roles)];
|
||||
short mask;
|
||||
} rfilter;
|
||||
} rfilter = { UNDEFINED_VALUES, UNDEFINED_VALUE};
|
||||
|
||||
STATIC_DCL int NDECL(randrole_filtered);
|
||||
STATIC_DCL char *FDECL(promptsep, (char *, int));
|
||||
@@ -1757,11 +1757,11 @@ winid where;
|
||||
not_yet[] = " not yet specified",
|
||||
rand_choice[] = " random";
|
||||
char buf[BUFSZ];
|
||||
int r, c, g, a, allowmask;
|
||||
int r, c, gend, a, allowmask;
|
||||
|
||||
r = flags.initrole;
|
||||
c = flags.initrace;
|
||||
g = flags.initgend;
|
||||
gend = flags.initgend;
|
||||
a = flags.initalign;
|
||||
if (r >= 0) {
|
||||
allowmask = roles[r].allow;
|
||||
@@ -1770,9 +1770,9 @@ winid where;
|
||||
else if (c >= 0 && !(allowmask & ROLE_RACEMASK & races[c].allow))
|
||||
c = ROLE_RANDOM;
|
||||
if ((allowmask & ROLE_GENDMASK) == ROLE_MALE)
|
||||
g = 0; /* role forces male (hypothetical) */
|
||||
gend = 0; /* role forces male (hypothetical) */
|
||||
else if ((allowmask & ROLE_GENDMASK) == ROLE_FEMALE)
|
||||
g = 1; /* role forces female (valkyrie) */
|
||||
gend = 1; /* role forces female (valkyrie) */
|
||||
if ((allowmask & ROLE_ALIGNMASK) == AM_LAWFUL)
|
||||
a = 0; /* aligns[lawful] */
|
||||
else if ((allowmask & ROLE_ALIGNMASK) == AM_NEUTRAL)
|
||||
@@ -1804,10 +1804,10 @@ winid where;
|
||||
: roles[r].name.m);
|
||||
if (r >= 0 && roles[r].name.f) {
|
||||
/* distinct female name [caveman/cavewoman, priest/priestess] */
|
||||
if (g == 1)
|
||||
if (gend == 1)
|
||||
/* female specified; replace male role name with female one */
|
||||
Sprintf(index(buf, ':'), ": %s", roles[r].name.f);
|
||||
else if (g < 0)
|
||||
else if (gend < 0)
|
||||
/* gender unspecified; append slash and female role name */
|
||||
Sprintf(eos(buf), "/%s", roles[r].name.f);
|
||||
}
|
||||
@@ -1820,11 +1820,11 @@ winid where;
|
||||
: races[c].noun);
|
||||
putstr(where, 0, buf);
|
||||
Sprintf(buf, "%12s ", "gender:");
|
||||
Strcat(buf, (which == RS_GENDER) ? choosing : (g == ROLE_NONE)
|
||||
Strcat(buf, (which == RS_GENDER) ? choosing : (gend == ROLE_NONE)
|
||||
? not_yet
|
||||
: (g == ROLE_RANDOM)
|
||||
: (gend == ROLE_RANDOM)
|
||||
? rand_choice
|
||||
: genders[g].adj);
|
||||
: genders[gend].adj);
|
||||
putstr(where, 0, buf);
|
||||
Sprintf(buf, "%12s ", "alignment:");
|
||||
Strcat(buf, (which == RS_ALGNMNT) ? choosing : (a == ROLE_NONE)
|
||||
@@ -1852,7 +1852,7 @@ boolean preselect;
|
||||
anything any;
|
||||
char buf[BUFSZ];
|
||||
const char *what = 0, *constrainer = 0, *forcedvalue = 0;
|
||||
int f = 0, r, c, g, a, i, allowmask;
|
||||
int f = 0, r, c, gend, a, i, allowmask;
|
||||
|
||||
r = flags.initrole;
|
||||
c = flags.initrace;
|
||||
@@ -1894,16 +1894,16 @@ boolean preselect;
|
||||
case RS_GENDER:
|
||||
what = "gender";
|
||||
f = flags.initgend;
|
||||
g = ROLE_NONE;
|
||||
gend = ROLE_NONE;
|
||||
if (r >= 0) {
|
||||
allowmask = roles[r].allow & ROLE_GENDMASK;
|
||||
if (allowmask == ROLE_MALE)
|
||||
g = 0; /* genders[male] */
|
||||
gend = 0; /* genders[male] */
|
||||
else if (allowmask == ROLE_FEMALE)
|
||||
g = 1; /* genders[female] */
|
||||
if (g >= 0) {
|
||||
gend = 1; /* genders[female] */
|
||||
if (gend >= 0) {
|
||||
constrainer = "role";
|
||||
forcedvalue = genders[g].adj;
|
||||
forcedvalue = genders[gend].adj;
|
||||
} else if (f >= 0
|
||||
&& (allowmask & ~rfilter.mask) == genders[f].allow) {
|
||||
/* if there is only one gender choice available due to user
|
||||
|
||||
+57
-68
@@ -45,17 +45,6 @@ STATIC_DCL void FDECL(init_rumors, (dlb *));
|
||||
STATIC_DCL void FDECL(init_oracles, (dlb *));
|
||||
STATIC_DCL void FDECL(couldnt_open_file, (const char *));
|
||||
|
||||
/* rumor size variables are signed so that value -1 can be used as a flag */
|
||||
static long true_rumor_size = 0L, false_rumor_size;
|
||||
/* rumor start offsets are unsigned because they're handled via %lx format */
|
||||
static unsigned long true_rumor_start, false_rumor_start;
|
||||
/* rumor end offsets are signed because they're compared with [dlb_]ftell() */
|
||||
static long true_rumor_end, false_rumor_end;
|
||||
/* oracles are handled differently from rumors... */
|
||||
static int oracle_flg = 0; /* -1=>don't use, 0=>need init, 1=>init done */
|
||||
static unsigned oracle_cnt = 0;
|
||||
static unsigned long *oracle_loc = 0;
|
||||
|
||||
STATIC_OVL void
|
||||
init_rumors(fp)
|
||||
dlb *fp;
|
||||
@@ -67,17 +56,17 @@ dlb *fp;
|
||||
|
||||
(void) dlb_fgets(line, sizeof line, fp); /* skip "don't edit" comment */
|
||||
(void) dlb_fgets(line, sizeof line, fp);
|
||||
if (sscanf(line, rumors_header, &true_count, &true_rumor_size,
|
||||
&true_rumor_start, &false_count, &false_rumor_size,
|
||||
&false_rumor_start, &eof_offset) == 7
|
||||
&& true_rumor_size > 0L
|
||||
&& false_rumor_size > 0L) {
|
||||
true_rumor_end = (long) true_rumor_start + true_rumor_size;
|
||||
/* assert( true_rumor_end == false_rumor_start ); */
|
||||
false_rumor_end = (long) false_rumor_start + false_rumor_size;
|
||||
/* assert( false_rumor_end == eof_offset ); */
|
||||
if (sscanf(line, rumors_header, &true_count, &g.true_rumor_size,
|
||||
&g.true_rumor_start, &false_count, &g.false_rumor_size,
|
||||
&g.false_rumor_start, &eof_offset) == 7
|
||||
&& g.true_rumor_size > 0L
|
||||
&& g.false_rumor_size > 0L) {
|
||||
g.true_rumor_end = (long) g.true_rumor_start + g.true_rumor_size;
|
||||
/* assert( g.true_rumor_end == false_rumor_start ); */
|
||||
g.false_rumor_end = (long) g.false_rumor_start + g.false_rumor_size;
|
||||
/* assert( g.false_rumor_end == eof_offset ); */
|
||||
} else {
|
||||
true_rumor_size = -1L; /* init failed */
|
||||
g.true_rumor_size = -1L; /* init failed */
|
||||
(void) dlb_fclose(fp);
|
||||
}
|
||||
}
|
||||
@@ -98,7 +87,7 @@ boolean exclude_cookie;
|
||||
char *endp, line[BUFSZ], xbuf[BUFSZ];
|
||||
|
||||
rumor_buf[0] = '\0';
|
||||
if (true_rumor_size < 0L) /* we couldn't open RUMORFILE */
|
||||
if (g.true_rumor_size < 0L) /* we couldn't open RUMORFILE */
|
||||
return rumor_buf;
|
||||
|
||||
rumors = dlb_fopen(RUMORFILE, "r");
|
||||
@@ -109,9 +98,9 @@ boolean exclude_cookie;
|
||||
|
||||
do {
|
||||
rumor_buf[0] = '\0';
|
||||
if (true_rumor_size == 0L) { /* if this is 1st outrumor() */
|
||||
if (g.true_rumor_size == 0L) { /* if this is 1st outrumor() */
|
||||
init_rumors(rumors);
|
||||
if (true_rumor_size < 0L) { /* init failed */
|
||||
if (g.true_rumor_size < 0L) { /* init failed */
|
||||
Sprintf(rumor_buf, "Error reading \"%.80s\".", RUMORFILE);
|
||||
return rumor_buf;
|
||||
}
|
||||
@@ -124,13 +113,13 @@ boolean exclude_cookie;
|
||||
switch (adjtruth = truth + rn2(2)) {
|
||||
case 2: /*(might let a bogus input arg sneak thru)*/
|
||||
case 1:
|
||||
beginning = (long) true_rumor_start;
|
||||
tidbit = Rand() % true_rumor_size;
|
||||
beginning = (long) g.true_rumor_start;
|
||||
tidbit = Rand() % g.true_rumor_size;
|
||||
break;
|
||||
case 0: /* once here, 0 => false rather than "either"*/
|
||||
case -1:
|
||||
beginning = (long) false_rumor_start;
|
||||
tidbit = Rand() % false_rumor_size;
|
||||
beginning = (long) g.false_rumor_start;
|
||||
tidbit = Rand() % g.false_rumor_size;
|
||||
break;
|
||||
default:
|
||||
impossible("strange truth value for rumor");
|
||||
@@ -139,7 +128,7 @@ boolean exclude_cookie;
|
||||
(void) dlb_fseek(rumors, beginning + tidbit, SEEK_SET);
|
||||
(void) dlb_fgets(line, sizeof line, rumors);
|
||||
if (!dlb_fgets(line, sizeof line, rumors)
|
||||
|| (adjtruth > 0 && dlb_ftell(rumors) > true_rumor_end)) {
|
||||
|| (adjtruth > 0 && dlb_ftell(rumors) > g.true_rumor_end)) {
|
||||
/* reached end of rumors -- go back to beginning */
|
||||
(void) dlb_fseek(rumors, beginning, SEEK_SET);
|
||||
(void) dlb_fgets(line, sizeof line, rumors);
|
||||
@@ -157,7 +146,7 @@ boolean exclude_cookie;
|
||||
exercise(A_WIS, (adjtruth > 0));
|
||||
} else {
|
||||
couldnt_open_file(RUMORFILE);
|
||||
true_rumor_size = -1; /* don't try to open it again */
|
||||
g.true_rumor_size = -1; /* don't try to open it again */
|
||||
}
|
||||
/* this is safe either way, so do it always since we can't get the definition
|
||||
* out of makedefs.c
|
||||
@@ -187,7 +176,7 @@ rumor_check()
|
||||
winid tmpwin;
|
||||
char *endp, line[BUFSZ], xbuf[BUFSZ], rumor_buf[BUFSZ];
|
||||
|
||||
if (true_rumor_size < 0L) { /* we couldn't open RUMORFILE */
|
||||
if (g.true_rumor_size < 0L) { /* we couldn't open RUMORFILE */
|
||||
no_rumors:
|
||||
pline("rumors not accessible.");
|
||||
return;
|
||||
@@ -199,9 +188,9 @@ rumor_check()
|
||||
long ftell_rumor_start = 0L;
|
||||
|
||||
rumor_buf[0] = '\0';
|
||||
if (true_rumor_size == 0L) { /* if this is 1st outrumor() */
|
||||
if (g.true_rumor_size == 0L) { /* if this is 1st outrumor() */
|
||||
init_rumors(rumors);
|
||||
if (true_rumor_size < 0L)
|
||||
if (g.true_rumor_size < 0L)
|
||||
goto no_rumors; /* init failed */
|
||||
}
|
||||
tmpwin = create_nhwindow(NHW_TEXT);
|
||||
@@ -213,17 +202,17 @@ rumor_check()
|
||||
Sprintf(
|
||||
rumor_buf,
|
||||
"T start=%06ld (%06lx), end=%06ld (%06lx), size=%06ld (%06lx)",
|
||||
(long) true_rumor_start, true_rumor_start, true_rumor_end,
|
||||
(unsigned long) true_rumor_end, true_rumor_size,
|
||||
(unsigned long) true_rumor_size);
|
||||
(long) g.true_rumor_start, g.true_rumor_start, g.true_rumor_end,
|
||||
(unsigned long) g.true_rumor_end, g.true_rumor_size,
|
||||
(unsigned long) g.true_rumor_size);
|
||||
putstr(tmpwin, 0, rumor_buf);
|
||||
|
||||
Sprintf(
|
||||
rumor_buf,
|
||||
"F start=%06ld (%06lx), end=%06ld (%06lx), size=%06ld (%06lx)",
|
||||
(long) false_rumor_start, false_rumor_start, false_rumor_end,
|
||||
(unsigned long) false_rumor_end, false_rumor_size,
|
||||
(unsigned long) false_rumor_size);
|
||||
(long) g.false_rumor_start, g.false_rumor_start, g.false_rumor_end,
|
||||
(unsigned long) g.false_rumor_end, g.false_rumor_size,
|
||||
(unsigned long) g.false_rumor_size);
|
||||
putstr(tmpwin, 0, rumor_buf);
|
||||
|
||||
/*
|
||||
@@ -234,7 +223,7 @@ rumor_check()
|
||||
* the value read in rumors, and display it.
|
||||
*/
|
||||
rumor_buf[0] = '\0';
|
||||
(void) dlb_fseek(rumors, (long) true_rumor_start, SEEK_SET);
|
||||
(void) dlb_fseek(rumors, (long) g.true_rumor_start, SEEK_SET);
|
||||
ftell_rumor_start = dlb_ftell(rumors);
|
||||
(void) dlb_fgets(line, sizeof line, rumors);
|
||||
if ((endp = index(line, '\n')) != 0)
|
||||
@@ -244,7 +233,7 @@ rumor_check()
|
||||
putstr(tmpwin, 0, rumor_buf);
|
||||
/* find last true rumor */
|
||||
while (dlb_fgets(line, sizeof line, rumors)
|
||||
&& dlb_ftell(rumors) < true_rumor_end)
|
||||
&& dlb_ftell(rumors) < g.true_rumor_end)
|
||||
continue;
|
||||
if ((endp = index(line, '\n')) != 0)
|
||||
*endp = 0;
|
||||
@@ -252,7 +241,7 @@ rumor_check()
|
||||
putstr(tmpwin, 0, rumor_buf);
|
||||
|
||||
rumor_buf[0] = '\0';
|
||||
(void) dlb_fseek(rumors, (long) false_rumor_start, SEEK_SET);
|
||||
(void) dlb_fseek(rumors, (long) g.false_rumor_start, SEEK_SET);
|
||||
ftell_rumor_start = dlb_ftell(rumors);
|
||||
(void) dlb_fgets(line, sizeof line, rumors);
|
||||
if ((endp = index(line, '\n')) != 0)
|
||||
@@ -262,7 +251,7 @@ rumor_check()
|
||||
putstr(tmpwin, 0, rumor_buf);
|
||||
/* find last false rumor */
|
||||
while (dlb_fgets(line, sizeof line, rumors)
|
||||
&& dlb_ftell(rumors) < false_rumor_end)
|
||||
&& dlb_ftell(rumors) < g.false_rumor_end)
|
||||
continue;
|
||||
if ((endp = index(line, '\n')) != 0)
|
||||
*endp = 0;
|
||||
@@ -274,7 +263,7 @@ rumor_check()
|
||||
destroy_nhwindow(tmpwin);
|
||||
} else {
|
||||
couldnt_open_file(RUMORFILE);
|
||||
true_rumor_size = -1; /* don't try to open it again */
|
||||
g.true_rumor_size = -1; /* don't try to open it again */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -379,11 +368,11 @@ dlb *fp;
|
||||
(void) dlb_fgets(line, sizeof line, fp); /* skip "don't edit" comment*/
|
||||
(void) dlb_fgets(line, sizeof line, fp);
|
||||
if (sscanf(line, "%5d\n", &cnt) == 1 && cnt > 0) {
|
||||
oracle_cnt = (unsigned) cnt;
|
||||
oracle_loc = (unsigned long *) alloc((unsigned) cnt * sizeof(long));
|
||||
g.oracle_cnt = (unsigned) cnt;
|
||||
g.oracle_loc = (unsigned long *) alloc((unsigned) cnt * sizeof(long));
|
||||
for (i = 0; i < cnt; i++) {
|
||||
(void) dlb_fgets(line, sizeof line, fp);
|
||||
(void) sscanf(line, "%5lx\n", &oracle_loc[i]);
|
||||
(void) sscanf(line, "%5lx\n", &g.oracle_loc[i]);
|
||||
}
|
||||
}
|
||||
return;
|
||||
@@ -394,14 +383,14 @@ save_oracles(fd, mode)
|
||||
int fd, mode;
|
||||
{
|
||||
if (perform_bwrite(mode)) {
|
||||
bwrite(fd, (genericptr_t) &oracle_cnt, sizeof oracle_cnt);
|
||||
if (oracle_cnt)
|
||||
bwrite(fd, (genericptr_t) oracle_loc, oracle_cnt * sizeof(long));
|
||||
bwrite(fd, (genericptr_t) &g.oracle_cnt, sizeof g.oracle_cnt);
|
||||
if (g.oracle_cnt)
|
||||
bwrite(fd, (genericptr_t) g.oracle_loc, g.oracle_cnt * sizeof(long));
|
||||
}
|
||||
if (release_data(mode)) {
|
||||
if (oracle_cnt) {
|
||||
free((genericptr_t) oracle_loc);
|
||||
oracle_loc = 0, oracle_cnt = 0, oracle_flg = 0;
|
||||
if (g.oracle_cnt) {
|
||||
free((genericptr_t) g.oracle_loc);
|
||||
g.oracle_loc = 0, g.oracle_cnt = 0, g.oracle_flg = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -410,11 +399,11 @@ void
|
||||
restore_oracles(fd)
|
||||
int fd;
|
||||
{
|
||||
mread(fd, (genericptr_t) &oracle_cnt, sizeof oracle_cnt);
|
||||
if (oracle_cnt) {
|
||||
oracle_loc = (unsigned long *) alloc(oracle_cnt * sizeof(long));
|
||||
mread(fd, (genericptr_t) oracle_loc, oracle_cnt * sizeof(long));
|
||||
oracle_flg = 1; /* no need to call init_oracles() */
|
||||
mread(fd, (genericptr_t) &g.oracle_cnt, sizeof g.oracle_cnt);
|
||||
if (g.oracle_cnt) {
|
||||
g.oracle_loc = (unsigned long *) alloc(g.oracle_cnt * sizeof(long));
|
||||
mread(fd, (genericptr_t) g.oracle_loc, g.oracle_cnt * sizeof(long));
|
||||
g.oracle_flg = 1; /* no need to call init_oracles() */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -431,27 +420,27 @@ boolean delphi;
|
||||
|
||||
/* early return if we couldn't open ORACLEFILE on previous attempt,
|
||||
or if all the oracularities are already exhausted */
|
||||
if (oracle_flg < 0 || (oracle_flg > 0 && oracle_cnt == 0))
|
||||
if (g.oracle_flg < 0 || (g.oracle_flg > 0 && g.oracle_cnt == 0))
|
||||
return;
|
||||
|
||||
oracles = dlb_fopen(ORACLEFILE, "r");
|
||||
|
||||
if (oracles) {
|
||||
winid tmpwin;
|
||||
if (oracle_flg == 0) { /* if this is the first outoracle() */
|
||||
if (g.oracle_flg == 0) { /* if this is the first outoracle() */
|
||||
init_oracles(oracles);
|
||||
oracle_flg = 1;
|
||||
if (oracle_cnt == 0)
|
||||
g.oracle_flg = 1;
|
||||
if (g.oracle_cnt == 0)
|
||||
return;
|
||||
}
|
||||
/* oracle_loc[0] is the special oracle;
|
||||
oracle_loc[1..oracle_cnt-1] are normal ones */
|
||||
if (oracle_cnt <= 1 && !special)
|
||||
if (g.oracle_cnt <= 1 && !special)
|
||||
return; /*(shouldn't happen)*/
|
||||
oracle_idx = special ? 0 : rnd((int) oracle_cnt - 1);
|
||||
(void) dlb_fseek(oracles, (long) oracle_loc[oracle_idx], SEEK_SET);
|
||||
oracle_idx = special ? 0 : rnd((int) g.oracle_cnt - 1);
|
||||
(void) dlb_fseek(oracles, (long) g.oracle_loc[oracle_idx], SEEK_SET);
|
||||
if (!special) /* move offset of very last one into this slot */
|
||||
oracle_loc[oracle_idx] = oracle_loc[--oracle_cnt];
|
||||
g.oracle_loc[oracle_idx] = g.oracle_loc[--g.oracle_cnt];
|
||||
|
||||
tmpwin = create_nhwindow(NHW_TEXT);
|
||||
if (delphi)
|
||||
@@ -473,7 +462,7 @@ boolean delphi;
|
||||
(void) dlb_fclose(oracles);
|
||||
} else {
|
||||
couldnt_open_file(ORACLEFILE);
|
||||
oracle_flg = -1; /* don't try to open it again */
|
||||
g.oracle_flg = -1; /* don't try to open it again */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -515,7 +504,7 @@ struct monst *oracl;
|
||||
break;
|
||||
case 'n':
|
||||
if (umoney <= (long) minor_cost /* don't even ask */
|
||||
|| (oracle_cnt == 1 || oracle_flg < 0))
|
||||
|| (g.oracle_cnt == 1 || g.oracle_flg < 0))
|
||||
return 0;
|
||||
Sprintf(qbuf, "\"Then dost thou desire a major one?\" (%d %s)",
|
||||
major_cost, currency((long) major_cost));
|
||||
|
||||
+10
-14
@@ -71,9 +71,6 @@ static struct save_procs {
|
||||
#define HUP
|
||||
#endif
|
||||
|
||||
/* need to preserve these during save to avoid accessing freed memory */
|
||||
static unsigned ustuck_id = 0, usteed_id = 0;
|
||||
|
||||
int
|
||||
dosave()
|
||||
{
|
||||
@@ -213,8 +210,8 @@ dosave0()
|
||||
store_version(fd);
|
||||
store_savefileinfo(fd);
|
||||
store_plname_in_file(fd);
|
||||
ustuck_id = (u.ustuck ? u.ustuck->m_id : 0);
|
||||
usteed_id = (u.usteed ? u.usteed->m_id : 0);
|
||||
g.ustuck_id = (u.ustuck ? u.ustuck->m_id : 0);
|
||||
g.usteed_id = (u.usteed ? u.usteed->m_id : 0);
|
||||
savelev(fd, ledger_no(&u.uz), WRITE_SAVE | FREE_SAVE);
|
||||
savegamestate(fd, WRITE_SAVE | FREE_SAVE);
|
||||
|
||||
@@ -336,10 +333,10 @@ register int fd, mode;
|
||||
sizeof(struct spell) * (MAXSPELL + 1));
|
||||
save_artifacts(fd);
|
||||
save_oracles(fd, mode);
|
||||
if (ustuck_id)
|
||||
bwrite(fd, (genericptr_t) &ustuck_id, sizeof ustuck_id);
|
||||
if (usteed_id)
|
||||
bwrite(fd, (genericptr_t) &usteed_id, sizeof usteed_id);
|
||||
if (g.ustuck_id)
|
||||
bwrite(fd, (genericptr_t) &g.ustuck_id, sizeof g.ustuck_id);
|
||||
if (g.usteed_id)
|
||||
bwrite(fd, (genericptr_t) &g.usteed_id, sizeof g.usteed_id);
|
||||
bwrite(fd, (genericptr_t) pl_character, sizeof pl_character);
|
||||
bwrite(fd, (genericptr_t) pl_fruit, sizeof pl_fruit);
|
||||
savefruitchn(fd, mode);
|
||||
@@ -369,7 +366,6 @@ void
|
||||
savestateinlock()
|
||||
{
|
||||
int fd, hpid;
|
||||
static boolean havestate = TRUE;
|
||||
char whynot[BUFSZ];
|
||||
|
||||
/* When checkpointing is on, the full state needs to be written
|
||||
@@ -383,7 +379,7 @@ savestateinlock()
|
||||
* noop pid rewriting will take place on the first "checkpoint" after
|
||||
* the game is started or restored, if checkpointing is off.
|
||||
*/
|
||||
if (flags.ins_chkpt || havestate) {
|
||||
if (flags.ins_chkpt || g.havestate) {
|
||||
/* save the rest of the current game state in the lock file,
|
||||
* following the original int pid, the current level number,
|
||||
* and the current savefile name, which should not be subject
|
||||
@@ -421,13 +417,13 @@ savestateinlock()
|
||||
store_savefileinfo(fd);
|
||||
store_plname_in_file(fd);
|
||||
|
||||
ustuck_id = (u.ustuck ? u.ustuck->m_id : 0);
|
||||
usteed_id = (u.usteed ? u.usteed->m_id : 0);
|
||||
g.ustuck_id = (u.ustuck ? u.ustuck->m_id : 0);
|
||||
g.usteed_id = (u.usteed ? u.usteed->m_id : 0);
|
||||
savegamestate(fd, WRITE_SAVE);
|
||||
}
|
||||
bclose(fd);
|
||||
}
|
||||
havestate = flags.ins_chkpt;
|
||||
g.havestate = flags.ins_chkpt;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -20,6 +20,9 @@ struct sysopt sysopt;
|
||||
void
|
||||
sys_early_init()
|
||||
{
|
||||
decl_globals_init();
|
||||
objects_globals_init();
|
||||
|
||||
sysopt.support = (char *) 0;
|
||||
sysopt.recover = (char *) 0;
|
||||
#ifdef SYSCF
|
||||
|
||||
+11
-14
@@ -39,9 +39,6 @@ STATIC_DCL boolean FDECL(thitm, (int, struct monst *, struct obj *, int,
|
||||
BOOLEAN_P));
|
||||
STATIC_DCL void NDECL(maybe_finish_sokoban);
|
||||
|
||||
/* mintrap() should take a flags argument, but for time being we use this */
|
||||
STATIC_VAR int force_mintrap = 0;
|
||||
|
||||
STATIC_VAR const char *const a_your[2] = { "a", "your" };
|
||||
STATIC_VAR const char *const A_Your[2] = { "A", "Your" };
|
||||
STATIC_VAR const char tower_of_flame[] = "tower of flame";
|
||||
@@ -2165,7 +2162,7 @@ register struct monst *mtmp;
|
||||
} else {
|
||||
register int tt = trap->ttyp;
|
||||
boolean in_sight, tear_web, see_it,
|
||||
inescapable = force_mintrap || ((tt == HOLE || tt == PIT)
|
||||
inescapable = g.force_mintrap || ((tt == HOLE || tt == PIT)
|
||||
&& Sokoban && !trap->madeby_u);
|
||||
const char *fallverb;
|
||||
|
||||
@@ -2281,7 +2278,7 @@ register struct monst *mtmp;
|
||||
|| mptr == &mons[PM_BUGBEAR])
|
||||
You_hear("the roaring of an angry bear!");
|
||||
}
|
||||
} else if (force_mintrap) {
|
||||
} else if (g.force_mintrap) {
|
||||
if (in_sight) {
|
||||
pline("%s evades %s bear trap!", Monnam(mtmp),
|
||||
a_your[trap->madeby_u]);
|
||||
@@ -2430,7 +2427,7 @@ register struct monst *mtmp;
|
||||
if (is_flyer(mptr) || is_floater(mptr)
|
||||
|| (mtmp->wormno && count_wsegs(mtmp) > 5)
|
||||
|| is_clinger(mptr)) {
|
||||
if (force_mintrap && !Sokoban) {
|
||||
if (g.force_mintrap && !Sokoban) {
|
||||
/* openfallingtrap; not inescapable here */
|
||||
if (in_sight) {
|
||||
seetrap(trap);
|
||||
@@ -2467,7 +2464,7 @@ register struct monst *mtmp;
|
||||
if (is_flyer(mptr) || is_floater(mptr) || mptr == &mons[PM_WUMPUS]
|
||||
|| (mtmp->wormno && count_wsegs(mtmp) > 5)
|
||||
|| mptr->msize >= MZ_HUGE) {
|
||||
if (force_mintrap && !Sokoban) {
|
||||
if (g.force_mintrap && !Sokoban) {
|
||||
/* openfallingtrap; not inescapable here */
|
||||
if (in_sight) {
|
||||
seetrap(trap);
|
||||
@@ -2556,7 +2553,7 @@ register struct monst *mtmp;
|
||||
a_your[trap->madeby_u]);
|
||||
deltrap(trap);
|
||||
newsym(mtmp->mx, mtmp->my);
|
||||
} else if (force_mintrap && !mtmp->mtrapped) {
|
||||
} else if (g.force_mintrap && !mtmp->mtrapped) {
|
||||
if (in_sight) {
|
||||
pline("%s avoids %s spider web!", Monnam(mtmp),
|
||||
a_your[trap->madeby_u]);
|
||||
@@ -4694,9 +4691,9 @@ boolean *noticed; /* set to true iff hero notices the effect; */
|
||||
/* dotrap calls mintrap when mounted hero encounters a web */
|
||||
if (u.usteed)
|
||||
dotrapflags |= NOWEBMSG;
|
||||
++force_mintrap;
|
||||
++g.force_mintrap;
|
||||
dotrap(t, dotrapflags);
|
||||
--force_mintrap;
|
||||
--g.force_mintrap;
|
||||
result = (u.utrap != 0);
|
||||
} else {
|
||||
if (mon->mtrapped)
|
||||
@@ -4704,9 +4701,9 @@ boolean *noticed; /* set to true iff hero notices the effect; */
|
||||
/* you notice it if you see the trap close/tremble/whatever
|
||||
or if you sense the monster who becomes trapped */
|
||||
*noticed = cansee(t->tx, t->ty) || canspotmon(mon);
|
||||
++force_mintrap;
|
||||
++g.force_mintrap;
|
||||
result = (mintrap(mon) != 0);
|
||||
--force_mintrap;
|
||||
--g.force_mintrap;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -4747,9 +4744,9 @@ boolean *noticed; /* set to true iff hero notices the effect; */
|
||||
*noticed = cansee(t->tx, t->ty) || canspotmon(mon);
|
||||
/* monster will be angered; mintrap doesn't handle that */
|
||||
wakeup(mon, TRUE);
|
||||
++force_mintrap;
|
||||
++g.force_mintrap;
|
||||
result = (mintrap(mon) != 0);
|
||||
--force_mintrap;
|
||||
--g.force_mintrap;
|
||||
/* mon might now be on the migrating monsters list */
|
||||
}
|
||||
return result;
|
||||
|
||||
+9
-13
@@ -974,15 +974,11 @@ register struct trobj *trop;
|
||||
struct obj *obj;
|
||||
int otyp, i;
|
||||
|
||||
while (trop->trclass) {
|
||||
while (trop->trclass) {
|
||||
otyp = (int) trop->trotyp;
|
||||
if (otyp != UNDEF_TYP) {
|
||||
obj = mksobj(otyp, TRUE, FALSE);
|
||||
} else { /* UNDEF_TYP */
|
||||
static NEARDATA short nocreate = STRANGE_OBJECT;
|
||||
static NEARDATA short nocreate2 = STRANGE_OBJECT;
|
||||
static NEARDATA short nocreate3 = STRANGE_OBJECT;
|
||||
static NEARDATA short nocreate4 = STRANGE_OBJECT;
|
||||
/*
|
||||
* For random objects, do not create certain overly powerful
|
||||
* items: wand of wishing, ring of levitation, or the
|
||||
@@ -995,9 +991,9 @@ register struct trobj *trop;
|
||||
*/
|
||||
obj = mkobj(trop->trclass, FALSE);
|
||||
otyp = obj->otyp;
|
||||
while (otyp == WAN_WISHING || otyp == nocreate
|
||||
|| otyp == nocreate2 || otyp == nocreate3
|
||||
|| otyp == nocreate4 || otyp == RIN_LEVITATION
|
||||
while (otyp == WAN_WISHING || otyp == g.nocreate
|
||||
|| otyp == g.nocreate2 || otyp == g.nocreate3
|
||||
|| otyp == g.nocreate4 || otyp == RIN_LEVITATION
|
||||
/* 'useless' items */
|
||||
|| otyp == POT_HALLUCINATION
|
||||
|| otyp == POT_ACID
|
||||
@@ -1039,16 +1035,16 @@ register struct trobj *trop;
|
||||
case WAN_POLYMORPH:
|
||||
case RIN_POLYMORPH:
|
||||
case POT_POLYMORPH:
|
||||
nocreate = RIN_POLYMORPH_CONTROL;
|
||||
g.nocreate = RIN_POLYMORPH_CONTROL;
|
||||
break;
|
||||
case RIN_POLYMORPH_CONTROL:
|
||||
nocreate = RIN_POLYMORPH;
|
||||
nocreate2 = SPE_POLYMORPH;
|
||||
nocreate3 = POT_POLYMORPH;
|
||||
g.nocreate = RIN_POLYMORPH;
|
||||
g.nocreate2 = SPE_POLYMORPH;
|
||||
g.nocreate3 = POT_POLYMORPH;
|
||||
}
|
||||
/* Don't have 2 of the same ring or spellbook */
|
||||
if (obj->oclass == RING_CLASS || obj->oclass == SPBOOK_CLASS)
|
||||
nocreate4 = otyp;
|
||||
g.nocreate4 = otyp;
|
||||
}
|
||||
|
||||
if (urace.malenum != PM_HUMAN) {
|
||||
|
||||
+6
-11
@@ -24,11 +24,6 @@ STATIC_DCL boolean FDECL(hmonas, (struct monst *));
|
||||
STATIC_DCL void FDECL(nohandglow, (struct monst *));
|
||||
STATIC_DCL boolean FDECL(shade_aware, (struct obj *));
|
||||
|
||||
extern boolean notonhead; /* for long worms */
|
||||
|
||||
/* Used to flag attacks caused by Stormbringer's maliciousness. */
|
||||
static boolean override_confirmation = FALSE;
|
||||
|
||||
#define PROJECTILE(obj) ((obj) && is_ammo(obj))
|
||||
|
||||
void
|
||||
@@ -213,7 +208,7 @@ struct obj *wep; /* uwep for attack(), null for kick_monster() */
|
||||
&& !Confusion && !Hallucination && !Stunned) {
|
||||
/* Intelligent chaotic weapons (Stormbringer) want blood */
|
||||
if (wep && wep->oartifact == ART_STORMBRINGER) {
|
||||
override_confirmation = TRUE;
|
||||
g.override_confirmation = TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
if (canspotmon(mtmp)) {
|
||||
@@ -387,7 +382,7 @@ register struct monst *mtmp;
|
||||
|
||||
/* possibly set in attack_checks;
|
||||
examined in known_hitum, called via hitum or hmonas below */
|
||||
override_confirmation = FALSE;
|
||||
g.override_confirmation = FALSE;
|
||||
/* attack_checks() used to use <u.ux+u.dx,u.uy+u.dy> directly, now
|
||||
it uses bhitpos instead; it might map an invisible monster there */
|
||||
bhitpos.x = u.ux + u.dx;
|
||||
@@ -470,7 +465,7 @@ int dieroll;
|
||||
/* hmon() might destroy weapon; remember aspect for cutworm */
|
||||
slice_or_chop = (weapon && (is_blade(weapon) || is_axe(weapon)));
|
||||
|
||||
if (override_confirmation) {
|
||||
if (g.override_confirmation) {
|
||||
/* this may need to be generalized if weapons other than
|
||||
Stormbringer acquire similar anti-social behavior... */
|
||||
if (flags.verbose)
|
||||
@@ -489,7 +484,7 @@ int dieroll;
|
||||
|
||||
/* we hit the monster; be careful: it might die or
|
||||
be knocked into a different location */
|
||||
notonhead = (mon->mx != x || mon->my != y);
|
||||
g.notonhead = (mon->mx != x || mon->my != y);
|
||||
malive = hmon(mon, weapon, HMON_MELEE, dieroll);
|
||||
if (malive) {
|
||||
/* monster still alive */
|
||||
@@ -623,7 +618,7 @@ struct attack *uattk;
|
||||
/* second attack for two-weapon combat; won't occur if Stormbringer
|
||||
overrode confirmation (assumes Stormbringer is primary weapon)
|
||||
or if the monster was killed or knocked to different location */
|
||||
if (u.twoweap && !override_confirmation && malive && m_at(x, y) == mon) {
|
||||
if (u.twoweap && !g.override_confirmation && malive && m_at(x, y) == mon) {
|
||||
tmp = find_roll_to_hit(mon, uattk->aatyp, uswapwep, &attknum,
|
||||
&armorpenalty);
|
||||
dieroll = rnd(20);
|
||||
@@ -1830,7 +1825,7 @@ register struct attack *mattk;
|
||||
case AD_DRIN: {
|
||||
struct obj *helmet;
|
||||
|
||||
if (notonhead || !has_head(pd)) {
|
||||
if (g.notonhead || !has_head(pd)) {
|
||||
pline("%s doesn't seem harmed.", Monnam(mdef));
|
||||
tmp = 0;
|
||||
if (!Unchanging && pd == &mons[PM_GREEN_SLIME]) {
|
||||
|
||||
+17
-19
@@ -387,8 +387,6 @@ static NEARDATA const int pwep[] = { HALBERD, BARDICHE, SPETUM,
|
||||
BEC_DE_CORBIN, FAUCHARD, PARTISAN,
|
||||
LANCE };
|
||||
|
||||
static struct obj *propellor;
|
||||
|
||||
/* select a ranged weapon for the monster */
|
||||
struct obj *
|
||||
select_rwep(mtmp)
|
||||
@@ -401,7 +399,7 @@ register struct monst *mtmp;
|
||||
|
||||
char mlet = mtmp->data->mlet;
|
||||
|
||||
propellor = &zeroobj;
|
||||
g.propellor = &zeroobj;
|
||||
Oselect(EGG); /* cockatrice egg */
|
||||
if (mlet == S_KOP) /* pies are first choice for Kops */
|
||||
Oselect(CREAM_PIE);
|
||||
@@ -433,7 +431,7 @@ register struct monst *mtmp;
|
||||
|| !mon_hates_silver(mtmp))) {
|
||||
if ((otmp = oselect(mtmp, pwep[i])) != 0
|
||||
&& (otmp == mwep || !mweponly)) {
|
||||
propellor = otmp; /* force the monster to wield it */
|
||||
g.propellor = otmp; /* force the monster to wield it */
|
||||
return otmp;
|
||||
}
|
||||
}
|
||||
@@ -454,41 +452,41 @@ register struct monst *mtmp;
|
||||
for (otmp = mtmp->minvent; otmp; otmp = otmp->nobj)
|
||||
if (otmp->oclass == GEM_CLASS
|
||||
&& (otmp->otyp != LOADSTONE || !otmp->cursed)) {
|
||||
propellor = m_carrying(mtmp, SLING);
|
||||
g.propellor = m_carrying(mtmp, SLING);
|
||||
return otmp;
|
||||
}
|
||||
}
|
||||
|
||||
/* KMH -- This belongs here so darts will work */
|
||||
propellor = &zeroobj;
|
||||
g.propellor = &zeroobj;
|
||||
|
||||
prop = (objects[rwep[i]]).oc_skill;
|
||||
if (prop < 0) {
|
||||
switch (-prop) {
|
||||
case P_BOW:
|
||||
propellor = (oselect(mtmp, YUMI));
|
||||
if (!propellor)
|
||||
propellor = (oselect(mtmp, ELVEN_BOW));
|
||||
if (!propellor)
|
||||
propellor = (oselect(mtmp, BOW));
|
||||
if (!propellor)
|
||||
propellor = (oselect(mtmp, ORCISH_BOW));
|
||||
g.propellor = (oselect(mtmp, YUMI));
|
||||
if (!g.propellor)
|
||||
g.propellor = (oselect(mtmp, ELVEN_BOW));
|
||||
if (!g.propellor)
|
||||
g.propellor = (oselect(mtmp, BOW));
|
||||
if (!g.propellor)
|
||||
g.propellor = (oselect(mtmp, ORCISH_BOW));
|
||||
break;
|
||||
case P_SLING:
|
||||
propellor = (oselect(mtmp, SLING));
|
||||
g.propellor = (oselect(mtmp, SLING));
|
||||
break;
|
||||
case P_CROSSBOW:
|
||||
propellor = (oselect(mtmp, CROSSBOW));
|
||||
g.propellor = (oselect(mtmp, CROSSBOW));
|
||||
}
|
||||
if ((otmp = MON_WEP(mtmp)) && mwelded(otmp) && otmp != propellor
|
||||
if ((otmp = MON_WEP(mtmp)) && mwelded(otmp) && otmp != g.propellor
|
||||
&& mtmp->weapon_check == NO_WEAPON_WANTED)
|
||||
propellor = 0;
|
||||
g.propellor = 0;
|
||||
}
|
||||
/* propellor = obj, propellor to use
|
||||
* propellor = &zeroobj, doesn't need a propellor
|
||||
* propellor = 0, needed one and didn't have one
|
||||
*/
|
||||
if (propellor != 0) {
|
||||
if (g.propellor != 0) {
|
||||
/* Note: cannot use m_carrying for loadstones, since it will
|
||||
* always select the first object of a type, and maybe the
|
||||
* monster is carrying two but only the first is unthrowable.
|
||||
@@ -635,7 +633,7 @@ register struct monst *mon;
|
||||
break;
|
||||
case NEED_RANGED_WEAPON:
|
||||
(void) select_rwep(mon);
|
||||
obj = propellor;
|
||||
obj = g.propellor;
|
||||
break;
|
||||
case NEED_PICK_AXE:
|
||||
obj = m_carrying(mon, PICK_AXE);
|
||||
|
||||
@@ -12,14 +12,6 @@
|
||||
*/
|
||||
#define MAGIC_COOKIE 1000
|
||||
|
||||
static NEARDATA boolean obj_zapped;
|
||||
static NEARDATA int poly_zapped;
|
||||
|
||||
extern boolean notonhead; /* for long worms */
|
||||
|
||||
/* kludge to use mondied instead of killed */
|
||||
extern boolean m_using;
|
||||
|
||||
STATIC_DCL void FDECL(polyuse, (struct obj *, int, int));
|
||||
STATIC_DCL void FDECL(create_polymon, (struct obj *, int));
|
||||
STATIC_DCL int FDECL(stone_to_flesh_obj, (struct obj *));
|
||||
@@ -149,7 +141,7 @@ struct obj *otmp;
|
||||
if (u.uswallow && mtmp == u.ustuck)
|
||||
reveal_invis = FALSE;
|
||||
|
||||
notonhead = (mtmp->mx != bhitpos.x || mtmp->my != bhitpos.y);
|
||||
g.notonhead = (mtmp->mx != bhitpos.x || mtmp->my != bhitpos.y);
|
||||
skilled_spell = (otmp && otmp->oclass == SPBOOK_CLASS && otmp->blessed);
|
||||
|
||||
switch (otyp) {
|
||||
@@ -487,7 +479,7 @@ struct monst *mtmp;
|
||||
struct obj *otmp;
|
||||
|
||||
mstatusline(mtmp);
|
||||
if (notonhead)
|
||||
if (g.notonhead)
|
||||
return; /* don't show minvent for long worm tail */
|
||||
|
||||
if (mtmp->minvent) {
|
||||
@@ -1368,13 +1360,13 @@ struct obj *obj;
|
||||
if (obj->otyp == SCR_MAIL)
|
||||
return;
|
||||
#endif
|
||||
obj_zapped = TRUE;
|
||||
g.obj_zapped = TRUE;
|
||||
|
||||
if (poly_zapped < 0) {
|
||||
if (g.poly_zapped < 0) {
|
||||
/* some may metamorphosize */
|
||||
for (i = obj->quan; i; i--)
|
||||
if (!rn2(Luck + 45)) {
|
||||
poly_zapped = objects[obj->otyp].oc_material;
|
||||
g.poly_zapped = objects[obj->otyp].oc_material;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2076,7 +2068,7 @@ schar zz;
|
||||
learnwand(obj);
|
||||
}
|
||||
|
||||
poly_zapped = -1;
|
||||
g.poly_zapped = -1;
|
||||
for (otmp = level.objects[tx][ty]; otmp; otmp = next_obj) {
|
||||
next_obj = otmp->nexthere;
|
||||
/* for zap downwards, don't hit object poly'd hero is hiding under */
|
||||
@@ -2086,8 +2078,8 @@ schar zz;
|
||||
|
||||
hitanything += (*fhito)(otmp, obj);
|
||||
}
|
||||
if (poly_zapped >= 0)
|
||||
create_polymon(level.objects[tx][ty], poly_zapped);
|
||||
if (g.poly_zapped >= 0)
|
||||
create_polymon(level.objects[tx][ty], g.poly_zapped);
|
||||
|
||||
return hitanything;
|
||||
}
|
||||
@@ -2618,7 +2610,7 @@ struct obj *obj; /* wand or spell */
|
||||
int steedhit = FALSE;
|
||||
|
||||
bhitpos.x = u.usteed->mx, bhitpos.y = u.usteed->my;
|
||||
notonhead = FALSE;
|
||||
g.notonhead = FALSE;
|
||||
switch (obj->otyp) {
|
||||
/*
|
||||
* Wands that are allowed to hit the steed
|
||||
@@ -2961,16 +2953,16 @@ struct obj *obj; /* wand or spell */
|
||||
void
|
||||
zapsetup()
|
||||
{
|
||||
obj_zapped = FALSE;
|
||||
g.obj_zapped = FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
zapwrapup()
|
||||
{
|
||||
/* if do_osshock() set obj_zapped while polying, give a message now */
|
||||
if (obj_zapped)
|
||||
if (g.obj_zapped)
|
||||
You_feel("shuddering vibrations.");
|
||||
obj_zapped = FALSE;
|
||||
g.obj_zapped = FALSE;
|
||||
}
|
||||
|
||||
/* called for various wand and spell effects - M. Stephenson */
|
||||
@@ -3301,7 +3293,7 @@ struct obj **pobj; /* object tossed/used, set to NULL
|
||||
}
|
||||
|
||||
if (mtmp && !(in_skip && M_IN_WATER(mtmp->data))) {
|
||||
notonhead = (bhitpos.x != mtmp->mx || bhitpos.y != mtmp->my);
|
||||
g.notonhead = (bhitpos.x != mtmp->mx || bhitpos.y != mtmp->my);
|
||||
if (weapon == FLASHED_LIGHT) {
|
||||
/* FLASHED_LIGHT hitting invisible monster should
|
||||
pass through instead of stop so we call
|
||||
@@ -4049,7 +4041,7 @@ boolean say; /* Announce out of sight hit/miss events if true */
|
||||
if (type >= 0)
|
||||
mon->mstrategy &= ~STRAT_WAITMASK;
|
||||
buzzmonst:
|
||||
notonhead = (mon->mx != bhitpos.x || mon->my != bhitpos.y);
|
||||
g.notonhead = (mon->mx != bhitpos.x || mon->my != bhitpos.y);
|
||||
if (zap_hit(find_mac(mon), spell_type)) {
|
||||
if (mon_reflects(mon, (char *) 0)) {
|
||||
if (cansee(mon->mx, mon->my)) {
|
||||
@@ -5122,7 +5114,7 @@ int damage, tell;
|
||||
if (damage) {
|
||||
mtmp->mhp -= damage;
|
||||
if (DEADMONSTER(mtmp)) {
|
||||
if (m_using)
|
||||
if (g.m_using)
|
||||
monkilled(mtmp, "", AD_RBRE);
|
||||
else
|
||||
killed(mtmp);
|
||||
|
||||
Reference in New Issue
Block a user