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 */
|
register int ntimes = 1; /* Number of player moves */
|
||||||
char *fp;
|
char *fp;
|
||||||
THING *mp;
|
THING *mp;
|
||||||
static char countch, direction, newcount = FALSE;
|
//static char countch, direction, newcount = FALSE;
|
||||||
if (on(player, ISHASTE))
|
if (on(player, ISHASTE))
|
||||||
ntimes++;
|
ntimes++;
|
||||||
/*
|
/*
|
||||||
@@ -74,7 +74,7 @@ command(struct rogue_state *rs)
|
|||||||
if (running || to_death)
|
if (running || to_death)
|
||||||
ch = runch;
|
ch = runch;
|
||||||
else if (count)
|
else if (count)
|
||||||
ch = countch;
|
ch = rs->countch;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ch = readchar(rs);
|
ch = readchar(rs);
|
||||||
@@ -98,11 +98,11 @@ command(struct rogue_state *rs)
|
|||||||
/*
|
/*
|
||||||
* check for prefixes
|
* check for prefixes
|
||||||
*/
|
*/
|
||||||
newcount = FALSE;
|
rs->newcount = FALSE;
|
||||||
if (isdigit(ch))
|
if (isdigit(ch))
|
||||||
{
|
{
|
||||||
count = 0;
|
count = 0;
|
||||||
newcount = TRUE;
|
rs->newcount = TRUE;
|
||||||
while (isdigit(ch))
|
while (isdigit(ch))
|
||||||
{
|
{
|
||||||
count = count * 10 + (ch - '0');
|
count = count * 10 + (ch - '0');
|
||||||
@@ -110,7 +110,7 @@ command(struct rogue_state *rs)
|
|||||||
count = 255;
|
count = 255;
|
||||||
ch = readchar(rs);
|
ch = readchar(rs);
|
||||||
}
|
}
|
||||||
countch = ch;
|
rs->countch = ch;
|
||||||
/*
|
/*
|
||||||
* turn off count for commands which don't make sense
|
* turn off count for commands which don't make sense
|
||||||
* to repeat
|
* to repeat
|
||||||
@@ -205,12 +205,12 @@ over:
|
|||||||
door_stop = TRUE;
|
door_stop = TRUE;
|
||||||
firstmove = TRUE;
|
firstmove = TRUE;
|
||||||
}
|
}
|
||||||
if (count && !newcount)
|
if (count && !rs->newcount)
|
||||||
ch = direction;
|
ch = rs->direction;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ch += ('A' - CTRL('A'));
|
ch += ('A' - CTRL('A'));
|
||||||
direction = ch;
|
rs->direction = ch;
|
||||||
}
|
}
|
||||||
goto over;
|
goto over;
|
||||||
}
|
}
|
||||||
@@ -372,7 +372,7 @@ over:
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
ch = dir_ch;
|
ch = dir_ch;
|
||||||
countch = dir_ch;
|
rs->countch = dir_ch;
|
||||||
goto over;
|
goto over;
|
||||||
}
|
}
|
||||||
when ')': current(rs,cur_weapon, "wielding", NULL);
|
when ')': current(rs,cur_weapon, "wielding", NULL);
|
||||||
|
|||||||
@@ -369,7 +369,7 @@ init_materials()
|
|||||||
{
|
{
|
||||||
register int i, j;
|
register int i, j;
|
||||||
register const char *str;
|
register const char *str;
|
||||||
static bool metused[NMETAL];
|
bool metused[NMETAL];
|
||||||
memset(metused,0,sizeof(metused));
|
memset(metused,0,sizeof(metused));
|
||||||
for (i = 0; i < NWOOD; i++)
|
for (i = 0; i < NWOOD; i++)
|
||||||
used[i] = FALSE;
|
used[i] = FALSE;
|
||||||
|
|||||||
@@ -18,12 +18,12 @@
|
|||||||
/*
|
/*
|
||||||
* List of monsters in rough order of vorpalness
|
* 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',
|
'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'
|
'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',
|
'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
|
0, 'Y', 0, 'T', 'W', 'P', 0, 'U', 'M', 'V', 'G', 'J', 0
|
||||||
};
|
};
|
||||||
@@ -119,8 +119,8 @@ void
|
|||||||
wanderer(struct rogue_state *rs)
|
wanderer(struct rogue_state *rs)
|
||||||
{
|
{
|
||||||
THING *tp;
|
THING *tp;
|
||||||
static coord cp;
|
coord cp;
|
||||||
|
memset(&cp,0,sizeof(cp));
|
||||||
tp = new_item();
|
tp = new_item();
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ typedef struct
|
|||||||
char *pa_high, *pa_straight;
|
char *pa_high, *pa_straight;
|
||||||
} PACT;
|
} PACT;
|
||||||
|
|
||||||
static PACT p_actions[] =
|
static const PACT p_actions[] =
|
||||||
{
|
{
|
||||||
{ ISHUH, unconfuse, HUHDURATION, /* P_CONFUSE */
|
{ ISHUH, unconfuse, HUHDURATION, /* P_CONFUSE */
|
||||||
"what a tripy feeling!",
|
"what a tripy feeling!",
|
||||||
|
|||||||
@@ -366,6 +366,7 @@ struct rogue_state
|
|||||||
uint32_t needflush,replaydone;
|
uint32_t needflush,replaydone;
|
||||||
int32_t numkeys,ind,num,guiflag,counter,sleeptime,playersize,restoring,lastnum;
|
int32_t numkeys,ind,num,guiflag,counter,sleeptime,playersize,restoring,lastnum;
|
||||||
FILE *logfp;
|
FILE *logfp;
|
||||||
|
char countch, direction, newcount;
|
||||||
struct rogue_player P;
|
struct rogue_player P;
|
||||||
char buffered[10000];
|
char buffered[10000];
|
||||||
uint8_t playerdata[10000];
|
uint8_t playerdata[10000];
|
||||||
|
|||||||
@@ -30,14 +30,10 @@ typedef struct spot { /* position matrix for maze positions */
|
|||||||
void
|
void
|
||||||
do_rooms(struct rogue_state *rs)
|
do_rooms(struct rogue_state *rs)
|
||||||
{
|
{
|
||||||
int i;
|
int i,left_out; struct room *rp; THING *tp;
|
||||||
struct room *rp;
|
//static coord top;
|
||||||
THING *tp;
|
coord mp,bsze,top; /* maximum room size */
|
||||||
int left_out;
|
memset(&top,0,sizeof(top));
|
||||||
static coord top;
|
|
||||||
coord bsze; /* maximum room size */
|
|
||||||
coord mp;
|
|
||||||
|
|
||||||
bsze.x = NUMCOLS / 3;
|
bsze.x = NUMCOLS / 3;
|
||||||
bsze.y = NUMLINES / 3;
|
bsze.y = NUMLINES / 3;
|
||||||
/*
|
/*
|
||||||
@@ -206,23 +202,18 @@ horiz(struct room *rp, int starty)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static int Maxy, Maxx, Starty, Startx;
|
static int Maxy, Maxx, Starty, Startx;
|
||||||
|
|
||||||
static SPOT maze[NUMLINES/3+1][NUMCOLS/3+1];
|
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;
|
SPOT *sp; int starty, startx;
|
||||||
int starty, startx;
|
coord pos;
|
||||||
static coord pos;
|
memset(&pos,0,sizeof(pos));
|
||||||
|
|
||||||
for (sp = &maze[0][0]; sp <= &maze[NUMLINES / 3][NUMCOLS / 3]; sp++)
|
for (sp = &maze[0][0]; sp <= &maze[NUMLINES / 3][NUMCOLS / 3]; sp++)
|
||||||
{
|
{
|
||||||
sp->used = FALSE;
|
sp->used = FALSE;
|
||||||
sp->nexits = 0;
|
sp->nexits = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Maxy = rp->r_max.y;
|
Maxy = rp->r_max.y;
|
||||||
Maxx = rp->r_max.x;
|
Maxx = rp->r_max.x;
|
||||||
Starty = rp->r_pos.y;
|
Starty = rp->r_pos.y;
|
||||||
@@ -245,11 +236,11 @@ dig(struct rogue_state *rs,int y, int x)
|
|||||||
{
|
{
|
||||||
coord *cp;
|
coord *cp;
|
||||||
int cnt, newy, newx, nexty = 0, nextx = 0;
|
int cnt, newy, newx, nexty = 0, nextx = 0;
|
||||||
static coord pos;
|
coord pos;
|
||||||
static coord del[4] = {
|
static const coord del[4] = {
|
||||||
{2, 0}, {-2, 0}, {0, 2}, {0, -2}
|
{2, 0}, {-2, 0}, {0, 2}, {0, -2}
|
||||||
};
|
};
|
||||||
|
memset(&pos,0,sizeof(pos));
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
if ( rs->replaydone != 0 )
|
if ( rs->replaydone != 0 )
|
||||||
|
|||||||
@@ -22,16 +22,9 @@
|
|||||||
void
|
void
|
||||||
read_scroll(struct rogue_state *rs)
|
read_scroll(struct rogue_state *rs)
|
||||||
{
|
{
|
||||||
THING *obj;
|
THING *obj,*orig_obj; PLACE *pp; int i, y, x; char ch;
|
||||||
PLACE *pp;
|
bool discardit = FALSE; struct room *cur_room; coord mp;
|
||||||
int y, x;
|
memset(&mp,0,sizeof(mp));
|
||||||
char ch;
|
|
||||||
int i;
|
|
||||||
bool discardit = FALSE;
|
|
||||||
struct room *cur_room;
|
|
||||||
THING *orig_obj;
|
|
||||||
static coord mp;
|
|
||||||
|
|
||||||
obj = get_item(rs,"read", SCROLL);
|
obj = get_item(rs,"read", SCROLL);
|
||||||
if (obj == NULL)
|
if (obj == NULL)
|
||||||
return;
|
return;
|
||||||
@@ -149,7 +142,7 @@ read_scroll(struct rogue_state *rs)
|
|||||||
case S_ID_ARMOR:
|
case S_ID_ARMOR:
|
||||||
case S_ID_R_OR_S:
|
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 };
|
{ 0, 0, 0, 0, 0, POTION, SCROLL, WEAPON, ARMOR, R_OR_S };
|
||||||
/*
|
/*
|
||||||
* Identify, let him figure something out
|
* Identify, let him figure something out
|
||||||
|
|||||||
@@ -245,16 +245,10 @@ do_zap(struct rogue_state *rs)
|
|||||||
* Do drain hit points from player shtick
|
* Do drain hit points from player shtick
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void drain(struct rogue_state *rs)
|
||||||
drain(struct rogue_state *rs)
|
|
||||||
{
|
{
|
||||||
THING *mp;
|
THING *mp,**dp; struct room *corp; int cnt; bool inpass; THING *drainee[40];
|
||||||
struct room *corp;
|
memset(drainee,0,sizeof(drainee));
|
||||||
THING **dp;
|
|
||||||
int cnt;
|
|
||||||
bool inpass;
|
|
||||||
static THING *drainee[40];
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* First cnt how many things we need to spread the hit points among
|
* First cnt how many things we need to spread the hit points among
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -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
|
* list what the player has discovered in this game of a certain type
|
||||||
*/
|
*/
|
||||||
static int line_cnt = 0;
|
static int line_cnt = 0;
|
||||||
|
|
||||||
static bool newpage = FALSE;
|
static bool newpage = FALSE;
|
||||||
|
|
||||||
static char *lastfmt, *lastarg;
|
static char *lastfmt, *lastarg;
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
discovered(struct rogue_state *rs)
|
discovered(struct rogue_state *rs)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
int group = 2;
|
int group = 2;
|
||||||
|
|
||||||
static struct init_weaps {
|
static const struct init_weaps {
|
||||||
char *iw_dam; /* Damage when wielded */
|
char *iw_dam; /* Damage when wielded */
|
||||||
char *iw_hrl; /* Damage when thrown */
|
char *iw_hrl; /* Damage when thrown */
|
||||||
char iw_launch; /* Launching weapon */
|
char iw_launch; /* Launching weapon */
|
||||||
@@ -125,8 +125,8 @@ void
|
|||||||
fall(struct rogue_state *rs,THING *obj, bool pr)
|
fall(struct rogue_state *rs,THING *obj, bool pr)
|
||||||
{
|
{
|
||||||
PLACE *pp;
|
PLACE *pp;
|
||||||
static coord fpos;
|
coord fpos;
|
||||||
|
memset(&fpos,0,sizeof(fpos));
|
||||||
if (fallpos(&obj->o_pos, &fpos))
|
if (fallpos(&obj->o_pos, &fpos))
|
||||||
{
|
{
|
||||||
pp = INDEX(fpos.y, fpos.x);
|
pp = INDEX(fpos.y, fpos.x);
|
||||||
@@ -197,8 +197,8 @@ init_weapon(THING *weap, int which)
|
|||||||
int
|
int
|
||||||
hit_monster(struct rogue_state *rs,int y, int x, THING *obj)
|
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.y = y;
|
||||||
mp.x = x;
|
mp.x = x;
|
||||||
return fight(rs,&mp, obj, TRUE);
|
return fight(rs,&mp, obj, TRUE);
|
||||||
|
|||||||
Reference in New Issue
Block a user