display_board(board,tg); display_piece(next,tg->next); display_piece(hold,tg->stored); display_score(score,tg); if ( (counter++ % 5) == 0 ) doupdate();
This commit is contained in:
@@ -885,10 +885,10 @@ long get_filesize(FILE *fp)
|
|||||||
gamesevent revendian(gamesevent revx)
|
gamesevent revendian(gamesevent revx)
|
||||||
{
|
{
|
||||||
int32_t i; gamesevent x = 0;
|
int32_t i; gamesevent x = 0;
|
||||||
fprintf(stderr,"%04x -> ",revx);
|
//fprintf(stderr,"%04x -> ",revx);
|
||||||
for (i=0; i<sizeof(gamesevent); i++)
|
for (i=0; i<sizeof(gamesevent); i++)
|
||||||
((uint8_t *)&x)[i] = ((uint8_t *)&revx)[sizeof(gamesevent)-1-i];
|
((uint8_t *)&x)[i] = ((uint8_t *)&revx)[sizeof(gamesevent)-1-i];
|
||||||
fprintf(stderr,"%04x\n",x);
|
//fprintf(stderr,"%04x\n",x);
|
||||||
return(x);
|
return(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -952,7 +952,7 @@ int32_t games_replay(uint64_t seed,int32_t sleeptime)
|
|||||||
if ( seed == 0 )
|
if ( seed == 0 )
|
||||||
seed = 777;
|
seed = 777;
|
||||||
keystrokes = games_keystrokesload(&num,seed,counter);
|
keystrokes = games_keystrokesload(&num,seed,counter);
|
||||||
fprintf(stderr,"keystrokes.%p num.%d\n",keystrokes,num);
|
//fprintf(stderr,"keystrokes.%p num.%d\n",keystrokes,num);
|
||||||
if ( num > 0 )
|
if ( num > 0 )
|
||||||
{
|
{
|
||||||
sprintf(fname,"%s.%llu.player",GAMENAME,(long long)seed);
|
sprintf(fname,"%s.%llu.player",GAMENAME,(long long)seed);
|
||||||
|
|||||||
@@ -299,11 +299,11 @@ static void tg_handle_move(struct games_state *rs,tetris_game *obj, tetris_move
|
|||||||
{
|
{
|
||||||
switch (move) {
|
switch (move) {
|
||||||
case TM_LEFT:
|
case TM_LEFT:
|
||||||
fprintf(stderr,"LEFT ");
|
//fprintf(stderr,"LEFT ");
|
||||||
tg_move(obj, -1);
|
tg_move(obj, -1);
|
||||||
break;
|
break;
|
||||||
case TM_RIGHT:
|
case TM_RIGHT:
|
||||||
fprintf(stderr,"RIGHT ");
|
//fprintf(stderr,"RIGHT ");
|
||||||
tg_move(obj, 1);
|
tg_move(obj, 1);
|
||||||
break;
|
break;
|
||||||
case TM_DROP:
|
case TM_DROP:
|
||||||
@@ -644,7 +644,7 @@ 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; uint32_t eventid = 0; tetris_game *tg;
|
||||||
WINDOW *board, *next, *hold, *score;
|
WINDOW *board, *next, *hold, *score;
|
||||||
if ( rs->guiflag != 0 )
|
if ( rs->guiflag != 0 || rs->sleeptime != 0 )
|
||||||
{
|
{
|
||||||
// NCURSES initialization:
|
// NCURSES initialization:
|
||||||
initscr(); // initialize curses
|
initscr(); // initialize curses
|
||||||
@@ -664,15 +664,18 @@ void *gamesiterate(struct games_state *rs)
|
|||||||
while ( running != 0 )
|
while ( running != 0 )
|
||||||
{
|
{
|
||||||
running = tg_tick(rs,tg,move);
|
running = tg_tick(rs,tg,move);
|
||||||
if ( rs->guiflag != 0 )
|
if ( rs->guiflag != 0 || rs->sleeptime != 0 )
|
||||||
{
|
{
|
||||||
#ifdef STANDALONE
|
|
||||||
display_board(board,tg);
|
display_board(board,tg);
|
||||||
display_piece(next,tg->next);
|
display_piece(next,tg->next);
|
||||||
display_piece(hold,tg->stored);
|
display_piece(hold,tg->stored);
|
||||||
display_score(score,tg);
|
display_score(score,tg);
|
||||||
if ( (counter++ % 5) == 0 )
|
if ( (counter++ % 5) == 0 )
|
||||||
doupdate();
|
doupdate();
|
||||||
|
}
|
||||||
|
if ( rs->guiflag != 0 )
|
||||||
|
{
|
||||||
|
#ifdef STANDALONE
|
||||||
sleep_milli(10);
|
sleep_milli(10);
|
||||||
c = games_readevent(rs);
|
c = games_readevent(rs);
|
||||||
if ( c <= 0x7f || skipcount == 0x3fff )
|
if ( c <= 0x7f || skipcount == 0x3fff )
|
||||||
@@ -687,6 +690,8 @@ void *gamesiterate(struct games_state *rs)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if ( rs->sleeptime >= 1000 )
|
||||||
|
sleep_milli(rs->sleeptime/1000);
|
||||||
if ( skipcount == 0 )
|
if ( skipcount == 0 )
|
||||||
{
|
{
|
||||||
c = games_readevent(rs);
|
c = games_readevent(rs);
|
||||||
|
|||||||
Reference in New Issue
Block a user