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

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