mirror of
https://github.com/Oibaf66/frodo-wii.git
synced 2024-11-10 21:55:11 +01:00
Add nunchuk support (Aaron Morris)
This commit is contained in:
parent
2bbbe035ff
commit
f42186e0ef
@ -5,7 +5,11 @@
|
|||||||
|
|
||||||
TODO: Crash on + in "Other" menu
|
TODO: Crash on + in "Other" menu
|
||||||
|
|
||||||
|
TODO: Handle Run/Stop in virtual keyboard (?)
|
||||||
|
|
||||||
version 8:
|
version 8:
|
||||||
|
* Make it possible to control the game with the Nunchuk (Aaron Morris)
|
||||||
|
|
||||||
* Correct binding of shifted keys (thanks to Bob Forgan)
|
* Correct binding of shifted keys (thanks to Bob Forgan)
|
||||||
|
|
||||||
* Fix binding keys without the classic controller (plus etc were missing)
|
* Fix binding keys without the classic controller (plus etc were missing)
|
||||||
|
@ -660,6 +660,46 @@ uint8 C64::poll_joystick(int port)
|
|||||||
extra_keys[WIIMOTE_MINUS] = (held_classic & CLASSIC_CTRL_BUTTON_MINUS) |
|
extra_keys[WIIMOTE_MINUS] = (held_classic & CLASSIC_CTRL_BUTTON_MINUS) |
|
||||||
held & WPAD_BUTTON_MINUS;
|
held & WPAD_BUTTON_MINUS;
|
||||||
|
|
||||||
|
// nunchuck .. just map to the d-pad!
|
||||||
|
if (wpad->exp.type == EXP_NUNCHUK)
|
||||||
|
{
|
||||||
|
held_nunchuck = 1;
|
||||||
|
|
||||||
|
// left
|
||||||
|
if((wpad->exp.nunchuk.js.ang>=270-45 && wpad->exp.nunchuk.js.ang<=270+45) && wpad->exp.nunchuk.js.mag>=0.9)
|
||||||
|
extra_keys[WIIMOTE_LEFT] = held_nunchuck;
|
||||||
|
|
||||||
|
// right
|
||||||
|
if((wpad->exp.nunchuk.js.ang>=90-45 && wpad->exp.nunchuk.js.ang<=90+45) && wpad->exp.nunchuk.js.mag>=0.9)
|
||||||
|
extra_keys[WIIMOTE_RIGHT] = held_nunchuck;
|
||||||
|
|
||||||
|
// up
|
||||||
|
if((wpad->exp.nunchuk.js.ang>=360-45 || wpad->exp.nunchuk.js.ang<=45) && wpad->exp.nunchuk.js.mag>=0.9)
|
||||||
|
extra_keys[WIIMOTE_UP] = held_nunchuck;
|
||||||
|
|
||||||
|
// down
|
||||||
|
if((wpad->exp.nunchuk.js.ang>=180-45 && wpad->exp.nunchuk.js.ang<=180+45) && wpad->exp.nunchuk.js.mag>=0.9)
|
||||||
|
extra_keys[WIIMOTE_DOWN] = held_nunchuck;
|
||||||
|
|
||||||
|
// up/left
|
||||||
|
if((wpad->exp.nunchuk.js.ang>=315-20 && wpad->exp.nunchuk.js.ang<=315+20) && wpad->exp.nunchuk.js.mag>=0.9)
|
||||||
|
extra_keys[WIIMOTE_LEFT] = extra_keys[WIIMOTE_UP] = held_nunchuck;
|
||||||
|
|
||||||
|
//up/right
|
||||||
|
if((wpad->exp.nunchuk.js.ang>=45-20 && wpad->exp.nunchuk.js.ang<=45+20) && wpad->exp.nunchuk.js.mag>=0.9)
|
||||||
|
extra_keys[WIIMOTE_RIGHT] = extra_keys[WIIMOTE_UP] = held_nunchuck;
|
||||||
|
|
||||||
|
//down/right
|
||||||
|
if((wpad->exp.nunchuk.js.ang>=135-20 && wpad->exp.nunchuk.js.ang<=135+20) && wpad->exp.nunchuk.js.mag>=0.9)
|
||||||
|
extra_keys[WIIMOTE_RIGHT] = extra_keys[WIIMOTE_DOWN] = held_nunchuck;
|
||||||
|
|
||||||
|
//down/left
|
||||||
|
if((wpad->exp.nunchuk.js.ang>=225-20 && wpad->exp.nunchuk.js.ang<=225+20) && wpad->exp.nunchuk.js.mag>=0.9)
|
||||||
|
extra_keys[WIIMOTE_LEFT] = extra_keys[WIIMOTE_DOWN] = held_nunchuck;
|
||||||
|
|
||||||
|
}
|
||||||
|
// eof nunchuck
|
||||||
|
|
||||||
/* Merge common keys */
|
/* Merge common keys */
|
||||||
int active_binded_keys[N_WIIMOTE_BINDINGS];
|
int active_binded_keys[N_WIIMOTE_BINDINGS];
|
||||||
memcpy(active_binded_keys, ThePrefs.JoystickKeyBinding, sizeof(active_binded_keys));
|
memcpy(active_binded_keys, ThePrefs.JoystickKeyBinding, sizeof(active_binded_keys));
|
||||||
|
Loading…
Reference in New Issue
Block a user