Exemplo n.º 1
0
static int getkeypress_select(int tm, int flags)
{
	int keypress = 0;
	int i;
#if TERM_RESIZING
	if (tm > 80)
		upd_termresize();
#endif
#if XLIB || ALLEGRO
	if (tm > 80 && in_xterm && game && game_running &&
	    !TWOPLAYER_MODE && !xterm_hasfocus())
		return STARTBTN;
#endif
	for (i = inpselect_dev(tm); i < NUM_INPUTDEVS && !keypress; i++) {
		if (i+1 == ignore_dev)
			continue;
		switch (i) {
		case 0:
			keypress = kb_getpress(flags);
			break;
#if JOYSTICK
		case 1:
		case 2:
			keypress = js_getpress(i-1, flags);
			break;
#endif
#if SOCKET
		case 3:
			keypress = sock_getkeypress(flags);
			if (ignore_dev)
				return 0;
#endif
		}
	}
	if (keypress)
		keypress |= player_flag(i-1, flags);
	return keypress;
}
Exemplo n.º 2
0
Arquivo: comm.c Projeto: gsrr/Python
void sock_initgame()
{
	static char saved_mode;
	static char saved_lineslimit;
	opponent_name[0] = '\0';
	if (sock_flags & CONN_PROXY) {
		game->mode = saved_mode;
		player1.lineslimit = saved_lineslimit;
	} else {
		saved_mode = game->mode;
		saved_lineslimit = player1.lineslimit;
		if (is_server)
			playerlist_n = 0;
	}
	if (is_server)
		player2.lineslimit = player1.lineslimit;
	else {
		sock_sendbyte('i');
		sock_sendplayer();
		if (waitinput_sock(500) || waitinput_sock(500))
			sock_getkeypress(0);
	}
}