Browse Source

display_board(board,tg); display_piece(next,tg->next); display_piece(hold,tg->stored); display_score(score,tg); if ( (counter++ % 5) == 0 ) doupdate();

jl777
jl777 5 years ago
parent
commit
a6bb64b2ea
  1. 6
      src/cc/dapps/dappstd.c
  2. 15
      src/cc/tetris.c

6
src/cc/dapps/dappstd.c

@ -885,10 +885,10 @@ long get_filesize(FILE *fp)
gamesevent revendian(gamesevent revx)
{
int32_t i; gamesevent x = 0;
fprintf(stderr,"%04x -> ",revx);
//fprintf(stderr,"%04x -> ",revx);
for (i=0; i<sizeof(gamesevent); i++)
((uint8_t *)&x)[i] = ((uint8_t *)&revx)[sizeof(gamesevent)-1-i];
fprintf(stderr,"%04x\n",x);
//fprintf(stderr,"%04x\n",x);
return(x);
}
@ -952,7 +952,7 @@ int32_t games_replay(uint64_t seed,int32_t sleeptime)
if ( seed == 0 )
seed = 777;
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 )
{
sprintf(fname,"%s.%llu.player",GAMENAME,(long long)seed);

15
src/cc/tetris.c

@ -299,11 +299,11 @@ static void tg_handle_move(struct games_state *rs,tetris_game *obj, tetris_move
{
switch (move) {
case TM_LEFT:
fprintf(stderr,"LEFT ");
//fprintf(stderr,"LEFT ");
tg_move(obj, -1);
break;
case TM_RIGHT:
fprintf(stderr,"RIGHT ");
//fprintf(stderr,"RIGHT ");
tg_move(obj, 1);
break;
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;
gamesevent c; uint16_t skipcount=0; uint32_t eventid = 0; tetris_game *tg;
WINDOW *board, *next, *hold, *score;
if ( rs->guiflag != 0 )
if ( rs->guiflag != 0 || rs->sleeptime != 0 )
{
// NCURSES initialization:
initscr(); // initialize curses
@ -664,15 +664,18 @@ void *gamesiterate(struct games_state *rs)
while ( running != 0 )
{
running = tg_tick(rs,tg,move);
if ( rs->guiflag != 0 )
if ( rs->guiflag != 0 || rs->sleeptime != 0 )
{
#ifdef STANDALONE
display_board(board,tg);
display_piece(next,tg->next);
display_piece(hold,tg->stored);
display_score(score,tg);
if ( (counter++ % 5) == 0 )
doupdate();
}
if ( rs->guiflag != 0 )
{
#ifdef STANDALONE
sleep_milli(10);
c = games_readevent(rs);
if ( c <= 0x7f || skipcount == 0x3fff )
@ -687,6 +690,8 @@ void *gamesiterate(struct games_state *rs)
}
else
{
if ( rs->sleeptime >= 1000 )
sleep_milli(rs->sleeptime/1000);
if ( skipcount == 0 )
{
c = games_readevent(rs);

Loading…
Cancel
Save