@@ -259,18 +259,22 @@ over:
|
|||||||
again = TRUE;
|
again = TRUE;
|
||||||
goto over;
|
goto over;
|
||||||
}
|
}
|
||||||
when 'q': quaff(rs);
|
case 'q': quaff(rs);
|
||||||
|
break;
|
||||||
when 'Q':
|
when 'Q':
|
||||||
after = FALSE;
|
after = FALSE;
|
||||||
q_comm = TRUE;
|
q_comm = TRUE;
|
||||||
quit(0);
|
if ( _quit() > 0 )
|
||||||
if ( rs->guiflag != 0 && rs->needflush == 0 )
|
{
|
||||||
rs->needflush = (uint32_t)time(NULL);
|
if ( rs->guiflag != 0 )
|
||||||
q_comm = FALSE;
|
{
|
||||||
if ( rs->guiflag != 0 )
|
if (rs->needflush == 0 )
|
||||||
rogue_bailout(rs);
|
rs->needflush = (uint32_t)time(NULL);
|
||||||
else rs->replaydone = (uint32_t)time(NULL);
|
rogue_bailout(rs);
|
||||||
return;
|
} else rs->replaydone = (uint32_t)time(NULL);
|
||||||
|
}
|
||||||
|
q_comm = FALSE;
|
||||||
|
return;
|
||||||
when 'i': after = FALSE; inventory(rs,pack, 0);
|
when 'i': after = FALSE; inventory(rs,pack, 0);
|
||||||
when 'I': after = FALSE; picky_inven(rs);
|
when 'I': after = FALSE; picky_inven(rs);
|
||||||
when 'd': drop(rs);
|
when 'd': drop(rs);
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ int32_t mvaddch(int32_t y, int32_t x, chtype ch)
|
|||||||
int32_t waddstr(WINDOW *win, const char *str)
|
int32_t waddstr(WINDOW *win, const char *str)
|
||||||
{
|
{
|
||||||
int32_t i;
|
int32_t i;
|
||||||
//fprintf(stderr,"%s\n",str);
|
fprintf(stderr,"%s\n",str);
|
||||||
for (i=0; str[i]!=0; i++)
|
for (i=0; str[i]!=0; i++)
|
||||||
waddch(win,str[i]);
|
waddch(win,str[i]);
|
||||||
return(0);
|
return(0);
|
||||||
|
|||||||
@@ -142,6 +142,7 @@ void leave(int);
|
|||||||
void my_exit(int st);
|
void my_exit(int st);
|
||||||
void playltchars(void);
|
void playltchars(void);
|
||||||
void quit(int);
|
void quit(int);
|
||||||
|
int32_t _quit();
|
||||||
void resetltchars(void);
|
void resetltchars(void);
|
||||||
void set_order(int *order, int numthings);
|
void set_order(int *order, int numthings);
|
||||||
void tstp(int ignored);
|
void tstp(int ignored);
|
||||||
|
|||||||
@@ -153,23 +153,26 @@ step_ok(int ch)
|
|||||||
char
|
char
|
||||||
readchar(struct rogue_state *rs)
|
readchar(struct rogue_state *rs)
|
||||||
{
|
{
|
||||||
char ch = -1;
|
char c,ch = -1;
|
||||||
if ( rs != 0 && rs->guiflag == 0 )
|
if ( rs != 0 && rs->guiflag == 0 )
|
||||||
{
|
{
|
||||||
static uint32_t counter;
|
static uint32_t counter;
|
||||||
if ( rs->ind < rs->numkeys )
|
if ( rs->ind < rs->numkeys )
|
||||||
{
|
{
|
||||||
//if ( rs->ind == rs->numkeys-1 )
|
c = rs->keystrokes[rs->ind++];
|
||||||
// rs->replaydone = (uint32_t)time(NULL);
|
while ( c == 'Q' && rs->ind < rs->numkeys )
|
||||||
//fprintf(stderr,"(%c) ",rs->keystrokes[rs->ind]);
|
{
|
||||||
return(rs->keystrokes[rs->ind++]);
|
fprintf(stderr,"Got 'Q' next (%c)\n",rs->keystrokes[rs->ind]); sleep(2);
|
||||||
|
if ( rs->keystrokes[rs->ind] == 'y' )
|
||||||
|
return(c);
|
||||||
|
rs->ind++;
|
||||||
|
c = rs->keystrokes[rs->ind++];
|
||||||
|
}
|
||||||
|
return(c);
|
||||||
}
|
}
|
||||||
if ( rs->replaydone != 0 && counter++ < 3 )
|
if ( rs->replaydone != 0 && counter++ < 3 )
|
||||||
fprintf(stderr,"replay finished but readchar called\n");
|
fprintf(stderr,"replay finished but readchar called\n");
|
||||||
rs->replaydone = (uint32_t)time(NULL);
|
rs->replaydone = (uint32_t)time(NULL);
|
||||||
//if ( (rand() & 1) == 0 )
|
|
||||||
// return(ESCAPE);
|
|
||||||
//else
|
|
||||||
if ( counter < 3 || (counter & 1) == 0 )
|
if ( counter < 3 || (counter & 1) == 0 )
|
||||||
return('y');
|
return('y');
|
||||||
else return(ESCAPE);
|
else return(ESCAPE);
|
||||||
@@ -180,7 +183,7 @@ readchar(struct rogue_state *rs)
|
|||||||
|
|
||||||
if (ch == 3)
|
if (ch == 3)
|
||||||
{
|
{
|
||||||
quit(0);
|
_quit();
|
||||||
return(27);
|
return(27);
|
||||||
}
|
}
|
||||||
if ( rs != 0 && rs->guiflag != 0 )
|
if ( rs != 0 && rs->guiflag != 0 )
|
||||||
|
|||||||
@@ -349,17 +349,36 @@ void
|
|||||||
chg_str(int amt)
|
chg_str(int amt)
|
||||||
{
|
{
|
||||||
//auto jl777: strange compiler error
|
//auto jl777: strange compiler error
|
||||||
str_t comp;
|
uint32_t comp;
|
||||||
|
|
||||||
if (amt == 0)
|
if (amt == 0)
|
||||||
return;
|
return;
|
||||||
add_str(&pstats.s_str, amt);
|
//add_str(&pstats.s_str, amt);
|
||||||
|
pstats.s_str += amt;
|
||||||
|
if ( pstats.s_str < 3 )
|
||||||
|
pstats.s_str = 3;
|
||||||
|
else if ( pstats.s_str > 31 )
|
||||||
|
pstats.s_str = 31;
|
||||||
comp = pstats.s_str;
|
comp = pstats.s_str;
|
||||||
if (ISRING(LEFT, R_ADDSTR))
|
if (ISRING(LEFT, R_ADDSTR))
|
||||||
add_str(&comp, -cur_ring[LEFT]->o_arm);
|
{
|
||||||
|
// add_str(&comp, -cur_ring[LEFT]->o_arm);
|
||||||
|
comp += -cur_ring[LEFT]->o_arm;
|
||||||
|
if ( comp < 3 )
|
||||||
|
comp = 3;
|
||||||
|
else if ( comp > 31 )
|
||||||
|
comp = 31;
|
||||||
|
}
|
||||||
if (ISRING(RIGHT, R_ADDSTR))
|
if (ISRING(RIGHT, R_ADDSTR))
|
||||||
add_str(&comp, -cur_ring[RIGHT]->o_arm);
|
{
|
||||||
if (comp > max_stats.s_str)
|
//add_str(&comp, -cur_ring[RIGHT]->o_arm);
|
||||||
|
comp += -cur_ring[RIGHT]->o_arm;
|
||||||
|
if ( comp < 3 )
|
||||||
|
comp = 3;
|
||||||
|
else if ( comp > 31 )
|
||||||
|
comp = 31;
|
||||||
|
}
|
||||||
|
if ( comp > max_stats.s_str )
|
||||||
max_stats.s_str = comp;
|
max_stats.s_str = comp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -613,30 +613,17 @@ playit(struct rogue_state *rs)
|
|||||||
endit(0);
|
endit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* quit:
|
|
||||||
* Have player make certain, then exit.
|
|
||||||
*/
|
|
||||||
|
|
||||||
void
|
|
||||||
quit(int sig)
|
int32_t _quit()
|
||||||
{
|
{
|
||||||
struct rogue_state *rs = &globalR;
|
struct rogue_state *rs = &globalR;
|
||||||
int oy, ox;
|
int oy, ox, c;
|
||||||
//fprintf(stderr,"inside quit(%d)\n",sig);
|
//fprintf(stderr,"inside quit(%d)\n",sig);
|
||||||
if ( rs->guiflag != 0 )
|
getyx(curscr, oy, ox);
|
||||||
{
|
msg(rs,"really quit?");
|
||||||
NOOP(sig);
|
sleep(1);
|
||||||
|
if ( (c= readchar(rs)) == 'y')
|
||||||
/*
|
|
||||||
* Reset the signal in case we got here via an interrupt
|
|
||||||
*/
|
|
||||||
if (!q_comm)
|
|
||||||
mpos = 0;
|
|
||||||
getyx(curscr, oy, ox);
|
|
||||||
msg(rs,"really quit?");
|
|
||||||
}
|
|
||||||
if (readchar(rs) == 'y')
|
|
||||||
{
|
{
|
||||||
if ( rs->guiflag != 0 )
|
if ( rs->guiflag != 0 )
|
||||||
{
|
{
|
||||||
@@ -653,11 +640,13 @@ quit(int sig)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
//score(rs,purse, 1, 0);
|
//score(rs,purse, 1, 0);
|
||||||
//fprintf(stderr,"done!\n");
|
fprintf(stderr,"done! (%c)\n",c);
|
||||||
}
|
}
|
||||||
|
return(1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
fprintf(stderr,"'Q' answer (%c)\n",c);
|
||||||
move(0, 0);
|
move(0, 0);
|
||||||
clrtoeol();
|
clrtoeol();
|
||||||
status(rs);
|
status(rs);
|
||||||
@@ -667,9 +656,33 @@ quit(int sig)
|
|||||||
mpos = 0;
|
mpos = 0;
|
||||||
count = 0;
|
count = 0;
|
||||||
to_death = FALSE;
|
to_death = FALSE;
|
||||||
|
return(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* quit:
|
||||||
|
* Have player make certain, then exit.
|
||||||
|
*/
|
||||||
|
|
||||||
|
void quit(int sig)
|
||||||
|
{
|
||||||
|
struct rogue_state *rs = &globalR;
|
||||||
|
int oy, ox, c;
|
||||||
|
//fprintf(stderr,"inside quit(%d)\n",sig);
|
||||||
|
if ( rs->guiflag != 0 )
|
||||||
|
{
|
||||||
|
NOOP(sig);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Reset the signal in case we got here via an interrupt
|
||||||
|
*/
|
||||||
|
if (!q_comm)
|
||||||
|
mpos = 0;
|
||||||
|
}
|
||||||
|
_quit();
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* leave:
|
* leave:
|
||||||
* Leave quickly, but curteously
|
* Leave quickly, but curteously
|
||||||
|
|||||||
Reference in New Issue
Block a user