First set of changes to move globals to instance_globals.

This commit is contained in:
Bart House
2018-11-23 21:29:19 -08:00
parent 616a469f0f
commit 912886a73f
51 changed files with 680 additions and 565 deletions

View File

@@ -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)