Gamepad support for weapon wheel.

This commit is contained in:
Mari the Deer 2024-03-20 13:43:38 +01:00
commit fd179fe12a
2 changed files with 11 additions and 4 deletions

View file

@ -619,6 +619,11 @@ extend Class SWWMHandler
else if ( cmd ~== "weapprev" ) WeapSel = -1;
if ( wsel && (wsel.stage < 2) )
{
// pov/dpad takes priority
if ( (e.KeyScan == InputEvent.Key_JoyPOV1_Up) || (e.KeyScan == InputEvent.Key_Pad_DPad_Up) )
WeapSel = -1;
else if ( (e.KeyScan == InputEvent.Key_JoyPOV1_Down) || (e.KeyScan == InputEvent.Key_Pad_DPad_Down) )
WeapSel = 1;
if ( WeapSel == 1 )
{
wsel.WeapNext();
@ -629,12 +634,14 @@ extend Class SWWMHandler
wsel.WeapPrev();
return true;
}
if ( cmd ~== "+attack" )
// Joy1 should be the same thing as the A button (usually)
if ( (e.KeyScan == InputEvent.Key_Joy1) || (e.KeyScan == InputEvent.Key_Pad_A) || (cmd ~== "+attack") )
{
wsel.WeapSel();
return true;
}
if ( cmd ~== "+altattack" )
// ditto for Joy2
if ( (e.KeyScan == InputEvent.Key_Joy2) || (e.KeyScan == InputEvent.Key_Pad_B) || (cmd ~== "+altattack") )
{
wsel.WeapCancel();
return true;