Exemplo n.º 1
0
static int setkeymapping_js(int i, int keypr)
{
	int b, b2;
	while (!(b = js_readbtn(i))) {
		if (inputdevs_fd[i+1] == -1)
			return STARTBTN;
		if (b = getkeypress_select(100, SINGLE_PL)) {
			if (b == ESC) {
				js_rmmapping(i, keypr);
				return MVDOWN;
			}
			return b;
		}
		sleep_msec(55);
	}
	b2 = js_readbtn(i);
	if (b > b2 && b2)
		b = b2;
	if (!key_is_valid(b, keypr))
		return b;
	if (b == MVUP && keypr == MVUP && js_getbtnfor(i, MVUP) == MVUP)
		return MVUP;
	js_setmapping(i, b, keypr);
	return MVDOWN;
}
Exemplo n.º 2
0
void js_setmapping(int i, int btn, int keypress)
{
	struct btns *js = btns_joyst+i;
	char *b;
	keypress &= 63 | IN_GAME;
	rmbtn(js, btn, keypress);
	b = getbtnfor(js, keypress);
	if (*b && !(keypress & IN_GAME) && keypress >= MVUP) {
		keypress |= IN_GAME;
		if (*b == *getbtnfor(js, keypress))
			js_setmapping(i, btn, keypress);
	}
	*b = btn;
}
Exemplo n.º 3
0
void js_setifnull(int i, int btn, int keypress)
{
	if (!js_getbtnfor(i, keypress))
		js_setmapping(i, btn, keypress);
}