Browse Source

Replay

jl777
jl777 5 years ago
parent
commit
63cc120297
  1. 25
      src/cc/tetris.c
  2. 2
      src/cc/tetris.cpp

25
src/cc/tetris.c

@ -644,8 +644,19 @@ 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;
// Create windows for each section of the interface.
if ( rs->guiflag != 0 )
{
// NCURSES initialization:
initscr(); // initialize curses
cbreak(); // pass key presses to program, but not signals
noecho(); // don't echo key presses to screen
keypad(stdscr, TRUE); // allow arrow keys
timeout(0); // no blocking on getch()
curs_set(0); // set the cursor to invisible
init_colors(); // setup tetris colors
}
tg = tg_create(rs,22, 10);
// Create windows for each section of the interface.
board = newwin(tg->rows + 2, 2 * tg->cols + 2, 0, 0);
next = newwin(6, 10, 0, 2 * (tg->cols + 1) + 1);
hold = newwin(6, 10, 7, 2 * (tg->cols + 1) + 1);
@ -668,7 +679,7 @@ void *gamesiterate(struct games_state *rs)
{
if ( skipcount > 0 )
issue_games_events(rs,Gametxidstr,eventid-skipcount,skipcount | 0x4000);
if ( c >= 0 )
if ( c <= 0x7f )
issue_games_events(rs,Gametxidstr,eventid,c);
skipcount = 0;
} else skipcount++;
@ -679,6 +690,7 @@ void *gamesiterate(struct games_state *rs)
if ( skipcount == 0 )
{
c = games_readevent(rs);
fprintf(stderr,"%04x\n",c);
if ( (c & 0x4000) == 0x4000 )
{
skipcount = (c & 0x3fff);
@ -833,15 +845,6 @@ int tetris(int argc, char **argv)
tg = tg_create(rs,22, 10);
}*/
// NCURSES initialization:
initscr(); // initialize curses
cbreak(); // pass key presses to program, but not signals
noecho(); // don't echo key presses to screen
keypad(stdscr, TRUE); // allow arrow keys
timeout(0); // no blocking on getch()
curs_set(0); // set the cursor to invisible
init_colors(); // setup tetris colors
// Game loop
tg = (tetris_game *)gamesiterate(rs);
games_bailout(rs);

2
src/cc/tetris.cpp

@ -91,7 +91,7 @@ gamesevent *games_extractgame(int32_t makefiles,char *str,int32_t *numkeysp,std:
UniValue obj;
//fprintf(stderr,"got baton\n");
seed = games_gamefields(obj,maxplayers,buyin,gametxid,gamesaddr);
fprintf(stderr,"(%s) found baton %s numkeys.%d seed.%llu playerdata.%d playertxid.%s\n",pname.size()!=0?pname.c_str():Games_pname.c_str(),batontxid.ToString().c_str(),numkeys,(long long)seed,(int32_t)playerdata.size(),playertxid.GetHex().c_str());
//fprintf(stderr,"(%s) found baton %s numkeys.%d seed.%llu playerdata.%d playertxid.%s\n",pname.size()!=0?pname.c_str():Games_pname.c_str(),batontxid.ToString().c_str(),numkeys,(long long)seed,(int32_t)playerdata.size(),playertxid.GetHex().c_str());
memset(&P,0,sizeof(P));
if ( playerdata.size() > 0 )
{

Loading…
Cancel
Save