@@ -13,6 +13,40 @@ public class GameOptions {
1313 public static final int CONTROL_KB = 0 ;
1414 public static final int CONTROL_MIXED = 1 ;
1515 public static final int CONTROL_MOUSE = 2 ;
16+ public static final int CONTROL_CONTROLLER = 3 ;
17+ public static final String DEFAULT_MOUSE_UP = "W" ;
18+ public static final String DEFAULT_MOUSE_DOWN = "S" ;
19+ public static final String DEFAULT_UP = "Up" ;
20+ public static final String DEFAULT_DOWN = "Down" ;
21+ public static final String DEFAULT_LEFT = "Left" ;
22+ public static final String DEFAULT_RIGHT = "Right" ;
23+ public static final String DEFAULT_SHOOT = "Space" ;
24+ public static final String DEFAULT_SHOOT2 = "L-Ctrl" ;
25+ public static final String DEFAULT_ABILITY = "L-Shift" ;
26+ public static final String DEFAULT_ESCAPE = "Escape" ;
27+ public static final String DEFAULT_MAP = "Tab" ;
28+ public static final String DEFAULT_INVENTORY = "I" ;
29+ public static final String DEFAULT_TALK = "T" ;
30+ public static final String DEFAULT_PAUSE = "P" ;
31+ public static final String DEFAULT_DROP = "D" ;
32+ public static final String DEFAULT_SELL = "S" ;
33+ public static final String DEFAULT_BUY = "B" ;
34+ public static final String DEFAULT_CHANGE_SHIP = "C" ;
35+ public static final String DEFAULT_HIRE_SHIP = "H" ;
36+ public static final int DEFAULT_AXIS_SHOOT = 1 ;
37+ public static final int DEFAULT_AXIS_SHOOT2 = 0 ;
38+ public static final int DEFAULT_AXIS_ABILITY = -1 ;
39+ public static final int DEFAULT_AXIS_LEFT_RIGHT = 2 ;
40+ public static final boolean DEFAULT_AXIS_LEFT_RIGHT_INVERTED_ = false ;
41+ public static final int DEFAULT_AXIS_UP_DOWN = 5 ;
42+ public static final boolean DEFAULT_AXIS_UP_DOWN_INVERTED_ = false ;
43+ public static final int DEFAULT_BUTTON_SHOOT = -1 ;
44+ public static final int DEFAULT_BUTTON_SHOOT2 = -1 ;
45+ public static final int DEFAULT_BUTTON_ABILITY = 14 ;
46+ public static final int DEFAULT_BUTTON_UP = -1 ;
47+ public static final int DEFAULT_BUTTON_DOWN = -1 ;
48+ public static final int DEFAULT_BUTTON_LEFT = -1 ;
49+ public static final int DEFAULT_BUTTON_RIGHT = -1 ;
1650
1751 public int x ;
1852 public int y ;
@@ -38,6 +72,20 @@ public class GameOptions {
3872 private String keyBuyMenuName ;
3973 private String keyChangeShipMenuName ;
4074 private String keyHireShipMenuName ;
75+ private int controllerAxisShoot ;
76+ private int controllerAxisShoot2 ;
77+ private int controllerAxisAbility ;
78+ private int controllerAxisLeftRight ;
79+ private boolean isControllerAxisLeftRightInverted ;
80+ private int controllerAxisUpDown ;
81+ private boolean isControllerAxisUpDownInverted ;
82+ private int controllerButtonShoot ;
83+ private int controllerButtonShoot2 ;
84+ private int controllerButtonAbility ;
85+ private int controllerButtonLeft ;
86+ private int controllerButtonRight ;
87+ private int controllerButtonUp ;
88+ private int controllerButtonDown ;
4189
4290 private SortedSet <String > supportedResolutions = new TreeSet <String >();
4391 private Iterator <String > resolutionIterator = null ;
@@ -49,25 +97,39 @@ public GameOptions(boolean mobile, SolFileReader reader) {
4997 fullscreen = r .b ("fullscreen" , false );
5098 controlType = mobile ? CONTROL_KB : r .i ("controlType" , CONTROL_MIXED );
5199 volMul = r .f ("vol" , 1 );
52- keyUpMouseName = r .s ("keyUpMouse" , "W" );
53- keyDownMouseName = r .s ("keyDownMouse" , "S" );
54- keyUpName = r .s ("keyUp" , "Up" );
55- keyDownName = r .s ("keyDown" , "Down" );
56- keyLeftName = r .s ("keyLeft" , "Left" );
57- keyRightName = r .s ("keyRight" , "Right" );
58- keyShootName = r .s ("keyShoot" , "Space" );
59- keyShoot2Name = r .s ("keyShoot2" , "L-Ctrl" );
60- keyAbilityName = r .s ("keyAbility" , "L-Shift" );
61- keyEscapeName = r .s ("keyEscape" , "Escape" );
62- keyMapName = r .s ("keyMap" , "Tab" );
63- keyInventoryName = r .s ("keyInventory" , "I" );
64- keyTalkName = r .s ("keyTalk" , "T" );
65- keyPauseName = r .s ("keyPause" , "P" );
66- keyDropName = r .s ("keyDrop" , "D" );
67- keySellMenuName = r .s ("keySellMenu" , "S" );
68- keyBuyMenuName = r .s ("keyBuyMenu" , "B" );
69- keyChangeShipMenuName = r .s ("keyChangeShipMenu" , "C" );
70- keyHireShipMenuName = r .s ("keyHireShipMenu" , "H" );
100+ keyUpMouseName = r .s ("keyUpMouse" , DEFAULT_MOUSE_UP );
101+ keyDownMouseName = r .s ("keyDownMouse" , DEFAULT_MOUSE_DOWN );
102+ keyUpName = r .s ("keyUp" , DEFAULT_UP );
103+ keyDownName = r .s ("keyDown" , DEFAULT_DOWN );
104+ keyLeftName = r .s ("keyLeft" , DEFAULT_LEFT );
105+ keyRightName = r .s ("keyRight" , DEFAULT_RIGHT );
106+ keyShootName = r .s ("keyShoot" , DEFAULT_SHOOT );
107+ keyShoot2Name = r .s ("keyShoot2" , DEFAULT_SHOOT2 );
108+ keyAbilityName = r .s ("keyAbility" , DEFAULT_ABILITY );
109+ keyEscapeName = r .s ("keyEscape" , DEFAULT_ESCAPE );
110+ keyMapName = r .s ("keyMap" , DEFAULT_MAP );
111+ keyInventoryName = r .s ("keyInventory" , DEFAULT_INVENTORY );
112+ keyTalkName = r .s ("keyTalk" , DEFAULT_TALK );
113+ keyPauseName = r .s ("keyPause" , DEFAULT_PAUSE );
114+ keyDropName = r .s ("keyDrop" , DEFAULT_DROP );
115+ keySellMenuName = r .s ("keySellMenu" , DEFAULT_SELL );
116+ keyBuyMenuName = r .s ("keyBuyMenu" , DEFAULT_BUY );
117+ keyChangeShipMenuName = r .s ("keyChangeShipMenu" , DEFAULT_CHANGE_SHIP );
118+ keyHireShipMenuName = r .s ("keyHireShipMenu" , DEFAULT_HIRE_SHIP );
119+ controllerAxisShoot = r .i ("controllerAxisShoot" , DEFAULT_AXIS_SHOOT );
120+ controllerAxisShoot2 = r .i ("controllerAxisShoot2" , DEFAULT_AXIS_SHOOT2 );
121+ controllerAxisAbility = r .i ("controllerAxisAbility" , DEFAULT_AXIS_ABILITY );
122+ controllerAxisLeftRight = r .i ("controllerAxisLeftRight" , DEFAULT_AXIS_LEFT_RIGHT );
123+ isControllerAxisLeftRightInverted = r .b ("isControllerAxisLeftRightInverted" , DEFAULT_AXIS_LEFT_RIGHT_INVERTED_ );
124+ controllerAxisUpDown = r .i ("controllerAxisUpDown" , DEFAULT_AXIS_UP_DOWN );
125+ isControllerAxisUpDownInverted = r .b ("isControllerAxisUpDownInverted" , DEFAULT_AXIS_UP_DOWN_INVERTED_ );
126+ controllerButtonShoot = r .i ("controllerButtonShoot" , DEFAULT_BUTTON_SHOOT );
127+ controllerButtonShoot2 = r .i ("controllerButtonShoot2" , DEFAULT_BUTTON_SHOOT2 );
128+ controllerButtonAbility = r .i ("controllerButtonAbility" , DEFAULT_BUTTON_ABILITY );
129+ controllerButtonLeft = r .i ("controllerButtonLeft" , DEFAULT_BUTTON_LEFT );
130+ controllerButtonRight = r .i ("controllerButtonRight" , DEFAULT_BUTTON_RIGHT );
131+ controllerButtonUp = r .i ("controllerButtonUp" , DEFAULT_BUTTON_UP );
132+ controllerButtonDown = r .i ("controllerButtonDown" , DEFAULT_BUTTON_DOWN );
71133 }
72134
73135 public void advanceReso () {
@@ -101,6 +163,8 @@ public void advanceReso() {
101163 public void advanceControlType (boolean mobile ) {
102164 if (controlType == CONTROL_KB ) {
103165 controlType = mobile ? CONTROL_MOUSE : CONTROL_MIXED ;
166+ } else if (controlType == CONTROL_MIXED ) {
167+ controlType = CONTROL_CONTROLLER ;
104168// } else if (controlType == CONTROL_MIXED) {
105169// controlType = CONTROL_MOUSE;
106170 } else {
@@ -136,7 +200,14 @@ public void save() {
136200 "keyLeft" , keyLeftName , "keyRight" , keyRightName , "keyShoot" , keyShootName , "keyShoot2" , getKeyShoot2Name (),
137201 "keyAbility" , getKeyAbilityName (), "keyEscape" , getKeyEscapeName (), "keyMap" , keyMapName , "keyInventory" , keyInventoryName ,
138202 "keyTalk" , getKeyTalkName (), "keyPause" , getKeyPauseName (), "keyDrop" , getKeyDropName (), "keySellMenu" , getKeySellMenuName (),
139- "keyBuyMenu" , getKeyBuyMenuName (), "keyChangeShipMenu" , getKeyChangeShipMenuName (), "keyHireShipMenu" , getKeyHireShipMenuName ());
203+ "keyBuyMenu" , getKeyBuyMenuName (), "keyChangeShipMenu" , getKeyChangeShipMenuName (), "keyHireShipMenu" , getKeyHireShipMenuName (),
204+ "controllerAxisShoot" , getControllerAxisShoot (), "controllerAxisShoot2" , getControllerAxisShoot2 (),
205+ "controllerAxisAbility" , getControllerAxisAbility (), "controllerAxisLeftRight" , getControllerAxisLeftRight (),
206+ "isControllerAxisLeftRightInverted" , isControllerAxisLeftRightInverted (), "controllerAxisUpDown" , getControllerAxisUpDown (),
207+ "isControllerAxisUpDownInverted" , isControllerAxisUpDownInverted (), "controllerButtonShoot" , getControllerButtonShoot (),
208+ "controllerButtonShoot2" , getControllerButtonShoot2 (), "controllerButtonAbility" , getControllerButtonAbility (),
209+ "controllerButtonLeft" , getControllerButtonLeft (), "controllerButtonRight" , getControllerButtonRight (),
210+ "controllerButtonUp" , getControllerButtonUp (), "controllerButtonDown" , getControllerButtonDown ());
140211 }
141212
142213 /**
@@ -574,4 +645,192 @@ public int getKeyHireShipMenu() {
574645 public String getKeyHireShipMenuName () {
575646 return keyHireShipMenuName ;
576647 }
648+
649+ public int getControllerAxisShoot () {
650+ return controllerAxisShoot ;
651+ }
652+
653+ public int getControllerAxisShoot2 () {
654+ return controllerAxisShoot2 ;
655+ }
656+
657+ public int getControllerAxisAbility () {
658+ return controllerAxisAbility ;
659+ }
660+
661+ public int getControllerAxisLeftRight () {
662+ return controllerAxisLeftRight ;
663+ }
664+
665+ public int getControllerAxisUpDown () {
666+ return controllerAxisUpDown ;
667+ }
668+
669+ public int getControllerButtonShoot () {
670+ return controllerButtonShoot ;
671+ }
672+
673+ public int getControllerButtonShoot2 () {
674+ return controllerButtonShoot2 ;
675+ }
676+
677+ public int getControllerButtonAbility () {
678+ return controllerButtonAbility ;
679+ }
680+
681+ public int getControllerButtonLeft () {
682+ return controllerButtonLeft ;
683+ }
684+
685+ public int getControllerButtonRight () {
686+ return controllerButtonRight ;
687+ }
688+
689+ public int getControllerButtonUp () {
690+ return controllerButtonUp ;
691+ }
692+
693+ public boolean isControllerAxisLeftRightInverted () {
694+ return isControllerAxisLeftRightInverted ;
695+ }
696+
697+ public boolean isControllerAxisUpDownInverted () {
698+ return isControllerAxisUpDownInverted ;
699+ }
700+
701+ public void setKeyUpMouseName (String keyUpMouseName ) {
702+ this .keyUpMouseName = keyUpMouseName ;
703+ }
704+
705+ public void setKeyDownMouseName (String keyDownMouseName ) {
706+ this .keyDownMouseName = keyDownMouseName ;
707+ }
708+
709+ public void setKeyUpName (String keyUpName ) {
710+ this .keyUpName = keyUpName ;
711+ }
712+
713+ public void setKeyDownName (String keyDownName ) {
714+ this .keyDownName = keyDownName ;
715+ }
716+
717+ public void setKeyLeftName (String keyLeftName ) {
718+ this .keyLeftName = keyLeftName ;
719+ }
720+
721+ public void setKeyRightName (String keyRightName ) {
722+ this .keyRightName = keyRightName ;
723+ }
724+
725+ public void setKeyShootName (String keyShootName ) {
726+ this .keyShootName = keyShootName ;
727+ }
728+
729+ public void setKeyShoot2Name (String keyShoot2Name ) {
730+ this .keyShoot2Name = keyShoot2Name ;
731+ }
732+
733+ public void setKeyAbilityName (String keyAbilityName ) {
734+ this .keyAbilityName = keyAbilityName ;
735+ }
736+
737+ public void setKeyEscapeName (String keyEscapeName ) {
738+ this .keyEscapeName = keyEscapeName ;
739+ }
740+
741+ public void setKeyMapName (String keyMapName ) {
742+ this .keyMapName = keyMapName ;
743+ }
744+
745+ public void setKeyInventoryName (String keyInventoryName ) {
746+ this .keyInventoryName = keyInventoryName ;
747+ }
748+
749+ public void setKeyTalkName (String keyTalkName ) {
750+ this .keyTalkName = keyTalkName ;
751+ }
752+
753+ public void setKeyPauseName (String keyPauseName ) {
754+ this .keyPauseName = keyPauseName ;
755+ }
756+
757+ public void setKeyDropName (String keyDropName ) {
758+ this .keyDropName = keyDropName ;
759+ }
760+
761+ public void setKeySellMenuName (String keySellMenuName ) {
762+ this .keySellMenuName = keySellMenuName ;
763+ }
764+
765+ public void setKeyBuyMenuName (String keyBuyMenuName ) {
766+ this .keyBuyMenuName = keyBuyMenuName ;
767+ }
768+
769+ public void setKeyChangeShipMenuName (String keyChangeShipMenuName ) {
770+ this .keyChangeShipMenuName = keyChangeShipMenuName ;
771+ }
772+
773+ public void setKeyHireShipMenuName (String keyHireShipMenuName ) {
774+ this .keyHireShipMenuName = keyHireShipMenuName ;
775+ }
776+
777+ public void setControllerAxisShoot (int controllerAxisShoot ) {
778+ this .controllerAxisShoot = controllerAxisShoot ;
779+ }
780+
781+ public void setControllerAxisShoot2 (int controllerAxisShoot2 ) {
782+ this .controllerAxisShoot2 = controllerAxisShoot2 ;
783+ }
784+
785+ public void setControllerAxisAbility (int controllerAxisAbility ) {
786+ this .controllerAxisAbility = controllerAxisAbility ;
787+ }
788+
789+ public void setControllerAxisLeftRight (int controllerAxisLeftRight ) {
790+ this .controllerAxisLeftRight = controllerAxisLeftRight ;
791+ }
792+
793+ public void setIsControllerAxisLeftRightInverted (boolean isControllerAxisLeftRightInverted ) {
794+ this .isControllerAxisLeftRightInverted = isControllerAxisLeftRightInverted ;
795+ }
796+
797+ public void setControllerAxisUpDown (int controllerAxisUpDown ) {
798+ this .controllerAxisUpDown = controllerAxisUpDown ;
799+ }
800+
801+ public void setIsControllerAxisUpDownInverted (boolean isControllerAxisUpDownInverted ) {
802+ this .isControllerAxisUpDownInverted = isControllerAxisUpDownInverted ;
803+ }
804+
805+ public void setControllerButtonShoot (int controllerButtonShoot ) {
806+ this .controllerButtonShoot = controllerButtonShoot ;
807+ }
808+
809+ public void setControllerButtonShoot2 (int controllerButtonShoot2 ) {
810+ this .controllerButtonShoot2 = controllerButtonShoot2 ;
811+ }
812+
813+ public void setControllerButtonAbility (int controllerButtonAbility ) {
814+ this .controllerButtonAbility = controllerButtonAbility ;
815+ }
816+
817+ public void setControllerButtonLeft (int controllerButtonLeft ) {
818+ this .controllerButtonLeft = controllerButtonLeft ;
819+ }
820+
821+ public void setControllerButtonRight (int controllerButtonRight ) {
822+ this .controllerButtonRight = controllerButtonRight ;
823+ }
824+
825+ public void setControllerButtonUp (int controllerButtonUp ) {
826+ this .controllerButtonUp = controllerButtonUp ;
827+ }
828+
829+ public int getControllerButtonDown () {
830+ return controllerButtonDown ;
831+ }
832+
833+ public void setControllerButtonDown (int controllerButtonDown ) {
834+ this .controllerButtonDown = controllerButtonDown ;
835+ }
577836}
0 commit comments