Test
This commit is contained in:
@@ -862,7 +862,7 @@ int32_t flushkeystrokes(struct games_state *rs,int32_t waitflag)
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void games_bailout(struct games_state *rs)
|
void gamesbailout(struct games_state *rs)
|
||||||
{
|
{
|
||||||
flushkeystrokes(rs,1);
|
flushkeystrokes(rs,1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -651,7 +651,7 @@ gamesevent games_readevent(struct games_state *rs);
|
|||||||
void *gamesiterate(struct games_state *rs)
|
void *gamesiterate(struct games_state *rs)
|
||||||
{
|
{
|
||||||
uint32_t counter = 0; bool running = true; tetris_move move = TM_NONE;
|
uint32_t counter = 0; bool running = true; tetris_move move = TM_NONE;
|
||||||
gamesevent c; uint16_t skipcount=0; uint32_t eventid = 0; tetris_game *tg;
|
gamesevent c; uint16_t skipcount=0; int32_t prevlevel; uint32_t eventid = 0; tetris_game *tg;
|
||||||
WINDOW *board, *next, *hold, *score;
|
WINDOW *board, *next, *hold, *score;
|
||||||
if ( rs->guiflag != 0 || rs->sleeptime != 0 )
|
if ( rs->guiflag != 0 || rs->sleeptime != 0 )
|
||||||
{
|
{
|
||||||
@@ -665,6 +665,7 @@ void *gamesiterate(struct games_state *rs)
|
|||||||
init_colors(); // setup tetris colors
|
init_colors(); // setup tetris colors
|
||||||
}
|
}
|
||||||
tg = tg_create(rs,22, 10);
|
tg = tg_create(rs,22, 10);
|
||||||
|
prevlevel = tg->level;
|
||||||
// Create windows for each section of the interface.
|
// Create windows for each section of the interface.
|
||||||
board = newwin(tg->rows + 2, 2 * tg->cols + 2, 0, 0);
|
board = newwin(tg->rows + 2, 2 * tg->cols + 2, 0, 0);
|
||||||
next = newwin(6, 10, 0, 2 * (tg->cols + 1) + 1);
|
next = newwin(6, 10, 0, 2 * (tg->cols + 1) + 1);
|
||||||
@@ -693,6 +694,11 @@ void *gamesiterate(struct games_state *rs)
|
|||||||
issue_games_events(rs,Gametxidstr,eventid-skipcount,skipcount | 0x4000);
|
issue_games_events(rs,Gametxidstr,eventid-skipcount,skipcount | 0x4000);
|
||||||
if ( c <= 0x7f )
|
if ( c <= 0x7f )
|
||||||
issue_games_events(rs,Gametxidstr,eventid,c);
|
issue_games_events(rs,Gametxidstr,eventid,c);
|
||||||
|
if ( tg->level != prevlevel )
|
||||||
|
{
|
||||||
|
flushkeystrokes(rs,0);
|
||||||
|
prevlevel = tg->level;
|
||||||
|
}
|
||||||
skipcount = 0;
|
skipcount = 0;
|
||||||
} else skipcount++;
|
} else skipcount++;
|
||||||
#endif
|
#endif
|
||||||
@@ -870,7 +876,7 @@ int tetris(int argc, char **argv)
|
|||||||
|
|
||||||
// Game loop
|
// Game loop
|
||||||
tg = (tetris_game *)gamesiterate(rs);
|
tg = (tetris_game *)gamesiterate(rs);
|
||||||
games_bailout(rs);
|
gamesbailout(rs);
|
||||||
// Deinitialize NCurses
|
// Deinitialize NCurses
|
||||||
wclear(stdscr);
|
wclear(stdscr);
|
||||||
endwin();
|
endwin();
|
||||||
|
|||||||
Reference in New Issue
Block a user