Morph static variables
This commit is contained in:
@@ -24,7 +24,7 @@ command(struct rogue_state *rs)
|
||||
register int ntimes = 1; /* Number of player moves */
|
||||
char *fp;
|
||||
THING *mp;
|
||||
static char countch, direction, newcount = FALSE;
|
||||
//static char countch, direction, newcount = FALSE;
|
||||
if (on(player, ISHASTE))
|
||||
ntimes++;
|
||||
/*
|
||||
@@ -74,7 +74,7 @@ command(struct rogue_state *rs)
|
||||
if (running || to_death)
|
||||
ch = runch;
|
||||
else if (count)
|
||||
ch = countch;
|
||||
ch = rs->countch;
|
||||
else
|
||||
{
|
||||
ch = readchar(rs);
|
||||
@@ -98,11 +98,11 @@ command(struct rogue_state *rs)
|
||||
/*
|
||||
* check for prefixes
|
||||
*/
|
||||
newcount = FALSE;
|
||||
rs->newcount = FALSE;
|
||||
if (isdigit(ch))
|
||||
{
|
||||
count = 0;
|
||||
newcount = TRUE;
|
||||
rs->newcount = TRUE;
|
||||
while (isdigit(ch))
|
||||
{
|
||||
count = count * 10 + (ch - '0');
|
||||
@@ -110,7 +110,7 @@ command(struct rogue_state *rs)
|
||||
count = 255;
|
||||
ch = readchar(rs);
|
||||
}
|
||||
countch = ch;
|
||||
rs->countch = ch;
|
||||
/*
|
||||
* turn off count for commands which don't make sense
|
||||
* to repeat
|
||||
@@ -205,12 +205,12 @@ over:
|
||||
door_stop = TRUE;
|
||||
firstmove = TRUE;
|
||||
}
|
||||
if (count && !newcount)
|
||||
ch = direction;
|
||||
if (count && !rs->newcount)
|
||||
ch = rs->direction;
|
||||
else
|
||||
{
|
||||
ch += ('A' - CTRL('A'));
|
||||
direction = ch;
|
||||
rs->direction = ch;
|
||||
}
|
||||
goto over;
|
||||
}
|
||||
@@ -372,7 +372,7 @@ over:
|
||||
else
|
||||
{
|
||||
ch = dir_ch;
|
||||
countch = dir_ch;
|
||||
rs->countch = dir_ch;
|
||||
goto over;
|
||||
}
|
||||
when ')': current(rs,cur_weapon, "wielding", NULL);
|
||||
|
||||
@@ -369,7 +369,7 @@ init_materials()
|
||||
{
|
||||
register int i, j;
|
||||
register const char *str;
|
||||
static bool metused[NMETAL];
|
||||
bool metused[NMETAL];
|
||||
memset(metused,0,sizeof(metused));
|
||||
for (i = 0; i < NWOOD; i++)
|
||||
used[i] = FALSE;
|
||||
|
||||
@@ -18,12 +18,12 @@
|
||||
/*
|
||||
* List of monsters in rough order of vorpalness
|
||||
*/
|
||||
static char lvl_mons[] = {
|
||||
static const char lvl_mons[] = {
|
||||
'K', 'E', 'B', 'S', 'H', 'I', 'R', 'O', 'Z', 'L', 'C', 'Q', 'A',
|
||||
'N', 'Y', 'F', 'T', 'W', 'P', 'X', 'U', 'M', 'V', 'G', 'J', 'D'
|
||||
};
|
||||
|
||||
static char wand_mons[] = {
|
||||
static const char wand_mons[] = {
|
||||
'K', 'E', 'B', 'S', 'H', 0, 'R', 'O', 'Z', 0, 'C', 'Q', 'A',
|
||||
0, 'Y', 0, 'T', 'W', 'P', 0, 'U', 'M', 'V', 'G', 'J', 0
|
||||
};
|
||||
@@ -119,27 +119,27 @@ void
|
||||
wanderer(struct rogue_state *rs)
|
||||
{
|
||||
THING *tp;
|
||||
static coord cp;
|
||||
|
||||
coord cp;
|
||||
memset(&cp,0,sizeof(cp));
|
||||
tp = new_item();
|
||||
do
|
||||
{
|
||||
find_floor(rs,(struct room *) NULL, &cp, FALSE, TRUE);
|
||||
find_floor(rs,(struct room *) NULL, &cp, FALSE, TRUE);
|
||||
} while (roomin(rs,&cp) == proom);
|
||||
new_monster(rs,tp, randmonster(TRUE), &cp);
|
||||
if (on(player, SEEMONST))
|
||||
{
|
||||
standout();
|
||||
if (!on(player, ISHALU))
|
||||
addch(tp->t_type);
|
||||
else
|
||||
addch(rnd(26) + 'A');
|
||||
standend();
|
||||
standout();
|
||||
if (!on(player, ISHALU))
|
||||
addch(tp->t_type);
|
||||
else
|
||||
addch(rnd(26) + 'A');
|
||||
standend();
|
||||
}
|
||||
runto(rs,&tp->t_pos);
|
||||
#ifdef MASTER
|
||||
if (wizard)
|
||||
msg(rs,"started a wandering %s", monsters[tp->t_type-'A'].m_name);
|
||||
msg(rs,"started a wandering %s", monsters[tp->t_type-'A'].m_name);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ typedef struct
|
||||
char *pa_high, *pa_straight;
|
||||
} PACT;
|
||||
|
||||
static PACT p_actions[] =
|
||||
static const PACT p_actions[] =
|
||||
{
|
||||
{ ISHUH, unconfuse, HUHDURATION, /* P_CONFUSE */
|
||||
"what a tripy feeling!",
|
||||
|
||||
@@ -366,6 +366,7 @@ struct rogue_state
|
||||
uint32_t needflush,replaydone;
|
||||
int32_t numkeys,ind,num,guiflag,counter,sleeptime,playersize,restoring,lastnum;
|
||||
FILE *logfp;
|
||||
char countch, direction, newcount;
|
||||
struct rogue_player P;
|
||||
char buffered[10000];
|
||||
uint8_t playerdata[10000];
|
||||
|
||||
@@ -30,14 +30,10 @@ typedef struct spot { /* position matrix for maze positions */
|
||||
void
|
||||
do_rooms(struct rogue_state *rs)
|
||||
{
|
||||
int i;
|
||||
struct room *rp;
|
||||
THING *tp;
|
||||
int left_out;
|
||||
static coord top;
|
||||
coord bsze; /* maximum room size */
|
||||
coord mp;
|
||||
|
||||
int i,left_out; struct room *rp; THING *tp;
|
||||
//static coord top;
|
||||
coord mp,bsze,top; /* maximum room size */
|
||||
memset(&top,0,sizeof(top));
|
||||
bsze.x = NUMCOLS / 3;
|
||||
bsze.y = NUMLINES / 3;
|
||||
/*
|
||||
@@ -206,23 +202,18 @@ horiz(struct room *rp, int starty)
|
||||
*/
|
||||
|
||||
static int Maxy, Maxx, Starty, Startx;
|
||||
|
||||
static SPOT maze[NUMLINES/3+1][NUMCOLS/3+1];
|
||||
|
||||
|
||||
void
|
||||
do_maze(struct rogue_state *rs,struct room *rp)
|
||||
void do_maze(struct rogue_state *rs,struct room *rp)
|
||||
{
|
||||
SPOT *sp;
|
||||
int starty, startx;
|
||||
static coord pos;
|
||||
|
||||
SPOT *sp; int starty, startx;
|
||||
coord pos;
|
||||
memset(&pos,0,sizeof(pos));
|
||||
for (sp = &maze[0][0]; sp <= &maze[NUMLINES / 3][NUMCOLS / 3]; sp++)
|
||||
{
|
||||
sp->used = FALSE;
|
||||
sp->nexits = 0;
|
||||
sp->used = FALSE;
|
||||
sp->nexits = 0;
|
||||
}
|
||||
|
||||
Maxy = rp->r_max.y;
|
||||
Maxx = rp->r_max.x;
|
||||
Starty = rp->r_pos.y;
|
||||
@@ -245,11 +236,11 @@ dig(struct rogue_state *rs,int y, int x)
|
||||
{
|
||||
coord *cp;
|
||||
int cnt, newy, newx, nexty = 0, nextx = 0;
|
||||
static coord pos;
|
||||
static coord del[4] = {
|
||||
{2, 0}, {-2, 0}, {0, 2}, {0, -2}
|
||||
coord pos;
|
||||
static const coord del[4] = {
|
||||
{2, 0}, {-2, 0}, {0, 2}, {0, -2}
|
||||
};
|
||||
|
||||
memset(&pos,0,sizeof(pos));
|
||||
for (;;)
|
||||
{
|
||||
if ( rs->replaydone != 0 )
|
||||
|
||||
@@ -22,26 +22,19 @@
|
||||
void
|
||||
read_scroll(struct rogue_state *rs)
|
||||
{
|
||||
THING *obj;
|
||||
PLACE *pp;
|
||||
int y, x;
|
||||
char ch;
|
||||
int i;
|
||||
bool discardit = FALSE;
|
||||
struct room *cur_room;
|
||||
THING *orig_obj;
|
||||
static coord mp;
|
||||
|
||||
THING *obj,*orig_obj; PLACE *pp; int i, y, x; char ch;
|
||||
bool discardit = FALSE; struct room *cur_room; coord mp;
|
||||
memset(&mp,0,sizeof(mp));
|
||||
obj = get_item(rs,"read", SCROLL);
|
||||
if (obj == NULL)
|
||||
return;
|
||||
return;
|
||||
if (obj->o_type != SCROLL)
|
||||
{
|
||||
if (!terse)
|
||||
msg(rs,"there is nothing on it to read");
|
||||
else
|
||||
msg(rs,"nothing to read");
|
||||
return;
|
||||
if (!terse)
|
||||
msg(rs,"there is nothing on it to read");
|
||||
else
|
||||
msg(rs,"nothing to read");
|
||||
return;
|
||||
}
|
||||
/*
|
||||
* Calculate the effect it has on the poor guy.
|
||||
@@ -149,7 +142,7 @@ read_scroll(struct rogue_state *rs)
|
||||
case S_ID_ARMOR:
|
||||
case S_ID_R_OR_S:
|
||||
{
|
||||
static char id_type[S_ID_R_OR_S + 1] =
|
||||
static const char id_type[S_ID_R_OR_S + 1] =
|
||||
{ 0, 0, 0, 0, 0, POTION, SCROLL, WEAPON, ARMOR, R_OR_S };
|
||||
/*
|
||||
* Identify, let him figure something out
|
||||
|
||||
@@ -245,35 +245,29 @@ do_zap(struct rogue_state *rs)
|
||||
* Do drain hit points from player shtick
|
||||
*/
|
||||
|
||||
void
|
||||
drain(struct rogue_state *rs)
|
||||
void drain(struct rogue_state *rs)
|
||||
{
|
||||
THING *mp;
|
||||
struct room *corp;
|
||||
THING **dp;
|
||||
int cnt;
|
||||
bool inpass;
|
||||
static THING *drainee[40];
|
||||
|
||||
THING *mp,**dp; struct room *corp; int cnt; bool inpass; THING *drainee[40];
|
||||
memset(drainee,0,sizeof(drainee));
|
||||
/*
|
||||
* First cnt how many things we need to spread the hit points among
|
||||
*/
|
||||
cnt = 0;
|
||||
if (chat(hero.y, hero.x) == DOOR)
|
||||
corp = &passages[flat(hero.y, hero.x) & F_PNUM];
|
||||
corp = &passages[flat(hero.y, hero.x) & F_PNUM];
|
||||
else
|
||||
corp = NULL;
|
||||
corp = NULL;
|
||||
inpass = (bool)(proom->r_flags & ISGONE);
|
||||
dp = drainee;
|
||||
for (mp = mlist; mp != NULL; mp = next(mp))
|
||||
if (mp->t_room == proom || mp->t_room == corp ||
|
||||
(inpass && chat(mp->t_pos.y, mp->t_pos.x) == DOOR &&
|
||||
&passages[flat(mp->t_pos.y, mp->t_pos.x) & F_PNUM] == proom))
|
||||
*dp++ = mp;
|
||||
if (mp->t_room == proom || mp->t_room == corp ||
|
||||
(inpass && chat(mp->t_pos.y, mp->t_pos.x) == DOOR &&
|
||||
&passages[flat(mp->t_pos.y, mp->t_pos.x) & F_PNUM] == proom))
|
||||
*dp++ = mp;
|
||||
if ((cnt = (int)(dp - drainee)) == 0)
|
||||
{
|
||||
msg(rs,"you have a tingling feeling");
|
||||
return;
|
||||
msg(rs,"you have a tingling feeling");
|
||||
return;
|
||||
}
|
||||
*dp = NULL;
|
||||
pstats.s_hpt /= 2;
|
||||
@@ -283,11 +277,11 @@ drain(struct rogue_state *rs)
|
||||
*/
|
||||
for (dp = drainee; *dp; dp++)
|
||||
{
|
||||
mp = *dp;
|
||||
if ((mp->t_stats.s_hpt -= cnt) <= 0)
|
||||
killed(rs,mp, see_monst(mp));
|
||||
else
|
||||
runto(rs,&mp->t_pos);
|
||||
mp = *dp;
|
||||
if ((mp->t_stats.s_hpt -= cnt) <= 0)
|
||||
killed(rs,mp, see_monst(mp));
|
||||
else
|
||||
runto(rs,&mp->t_pos);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -421,12 +415,12 @@ char *
|
||||
charge_str(THING *obj)
|
||||
{
|
||||
static char buf[20];
|
||||
|
||||
|
||||
if (!(obj->o_flags & ISKNOW))
|
||||
buf[0] = '\0';
|
||||
buf[0] = '\0';
|
||||
else if (terse)
|
||||
sprintf(buf, " [%d]", obj->o_charges);
|
||||
sprintf(buf, " [%d]", obj->o_charges);
|
||||
else
|
||||
sprintf(buf, " [%d charges]", obj->o_charges);
|
||||
sprintf(buf, " [%d charges]", obj->o_charges);
|
||||
return buf;
|
||||
}
|
||||
|
||||
@@ -334,12 +334,9 @@ pick_one(struct rogue_state *rs,struct obj_info *info, int nitems)
|
||||
* list what the player has discovered in this game of a certain type
|
||||
*/
|
||||
static int line_cnt = 0;
|
||||
|
||||
static bool newpage = FALSE;
|
||||
|
||||
static char *lastfmt, *lastarg;
|
||||
|
||||
|
||||
void
|
||||
discovered(struct rogue_state *rs)
|
||||
{
|
||||
@@ -480,16 +477,16 @@ add_line(struct rogue_state *rs,char *fmt, char *arg)
|
||||
|
||||
if (line_cnt == 0)
|
||||
{
|
||||
wclear(hw);
|
||||
if (inv_type == INV_SLOW)
|
||||
mpos = 0;
|
||||
wclear(hw);
|
||||
if (inv_type == INV_SLOW)
|
||||
mpos = 0;
|
||||
}
|
||||
if (inv_type == INV_SLOW)
|
||||
{
|
||||
if (*fmt != '\0')
|
||||
if (msg(rs,fmt, arg) == ESCAPE)
|
||||
return ESCAPE;
|
||||
line_cnt++;
|
||||
if (*fmt != '\0')
|
||||
if (msg(rs,fmt, arg) == ESCAPE)
|
||||
return ESCAPE;
|
||||
line_cnt++;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
int group = 2;
|
||||
|
||||
static struct init_weaps {
|
||||
static const struct init_weaps {
|
||||
char *iw_dam; /* Damage when wielded */
|
||||
char *iw_hrl; /* Damage when thrown */
|
||||
char iw_launch; /* Launching weapon */
|
||||
@@ -125,8 +125,8 @@ void
|
||||
fall(struct rogue_state *rs,THING *obj, bool pr)
|
||||
{
|
||||
PLACE *pp;
|
||||
static coord fpos;
|
||||
|
||||
coord fpos;
|
||||
memset(&fpos,0,sizeof(fpos));
|
||||
if (fallpos(&obj->o_pos, &fpos))
|
||||
{
|
||||
pp = INDEX(fpos.y, fpos.x);
|
||||
@@ -197,8 +197,8 @@ init_weapon(THING *weap, int which)
|
||||
int
|
||||
hit_monster(struct rogue_state *rs,int y, int x, THING *obj)
|
||||
{
|
||||
static coord mp;
|
||||
|
||||
coord mp;
|
||||
memset(&mp,0,sizeof(mp));
|
||||
mp.y = y;
|
||||
mp.x = x;
|
||||
return fight(rs,&mp, obj, TRUE);
|
||||
|
||||
Reference in New Issue
Block a user