summaryrefslogtreecommitdiffstats
path: root/src/core/ControllerConfig.h
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2019-10-27 10:51:24 +0100
committerNikolay Korolev <nickvnuk@gmail.com>2019-10-27 10:51:24 +0100
commit62240606271b80ad5f8cc47f30d6f3f974d1fabe (patch)
tree0ec36dae8d78c49b21d3cce71c16c9e0da8c74e8 /src/core/ControllerConfig.h
parentscript 600-699 (diff)
parentMerge pull request #259 from Fire-Head/master (diff)
downloadre3-62240606271b80ad5f8cc47f30d6f3f974d1fabe.tar
re3-62240606271b80ad5f8cc47f30d6f3f974d1fabe.tar.gz
re3-62240606271b80ad5f8cc47f30d6f3f974d1fabe.tar.bz2
re3-62240606271b80ad5f8cc47f30d6f3f974d1fabe.tar.lz
re3-62240606271b80ad5f8cc47f30d6f3f974d1fabe.tar.xz
re3-62240606271b80ad5f8cc47f30d6f3f974d1fabe.tar.zst
re3-62240606271b80ad5f8cc47f30d6f3f974d1fabe.zip
Diffstat (limited to '')
-rw-r--r--src/core/ControllerConfig.h244
1 files changed, 166 insertions, 78 deletions
diff --git a/src/core/ControllerConfig.h b/src/core/ControllerConfig.h
index ab17577b..e7abb21d 100644
--- a/src/core/ControllerConfig.h
+++ b/src/core/ControllerConfig.h
@@ -5,65 +5,94 @@
enum eControllerType
{
- KEYBOARD,
+ KEYBOARD = 0,
OPTIONAL_EXTRA,
MOUSE,
JOYSTICK,
- TOTAL_CONTROLLER_TYPES
+ MAX_CONTROLLERTYPES,
};
-enum e_ControllerAction
-{
- PED_FIREWEAPON = 0,
- PED_CYCLE_WEAPON_RIGHT,
- PED_CYCLE_WEAPON_LEFT,
- GO_FORWARD,
- GO_BACK,
- GO_LEFT,
- GO_RIGHT,
- PED_SNIPER_ZOOM_IN,
- PED_SNIPER_ZOOM_OUT,
- VEHICLE_ENTER_EXIT,
- CAMERA_CHANGE_VIEW_ALL_SITUATIONS,
- PED_JUMPING,
- PED_SPRINT,
- PED_LOOKBEHIND,
- //PED_DUCK, // VC
- //PED_ANSWER_PHONE, // VC
- VEHICLE_ACCELERATE,
- VEHICLE_BRAKE,
- VEHICLE_CHANGE_RADIO_STATION,
- VEHICLE_HORN,
- TOGGLE_SUBMISSIONS,
- VEHICLE_HANDBRAKE,
- PED_1RST_PERSON_LOOK_LEFT,
- PED_1RST_PERSON_LOOK_RIGHT,
- VEHICLE_LOOKLEFT,
- VEHICLE_LOOKRIGHT,
- VEHICLE_LOOKBEHIND,
- VEHICLE_TURRETLEFT,
- VEHICLE_TURRETRIGHT,
- VEHICLE_TURRETUP,
- VEHICLE_TURRETDOWN,
- PED_CYCLE_TARGET_LEFT,
- PED_CYCLE_TARGET_RIGHT,
- PED_CENTER_CAMERA_BEHIND_PLAYER,
- PED_LOCK_TARGET,
- NETWORK_TALK,
- PED_1RST_PERSON_LOOK_UP,
- PED_1RST_PERSON_LOOK_DOWN,
-
- CONTROLLERACTION_36, // unk, unused?
-
- TOGGLE_DPAD,
- SWITCH_DEBUG_CAM_ON,
- TAKE_SCREEN_SHOT,
- SHOW_MOUSE_POINTER_TOGGLE,
-
- TOTAL_CONTROL_ACTIONS
+enum e_ControllerAction
+{
+ PED_FIREWEAPON = 0,
+ PED_CYCLE_WEAPON_RIGHT,
+ PED_CYCLE_WEAPON_LEFT,
+ GO_FORWARD,
+ GO_BACK,
+ GO_LEFT,
+ GO_RIGHT,
+ PED_SNIPER_ZOOM_IN,
+ PED_SNIPER_ZOOM_OUT,
+ VEHICLE_ENTER_EXIT,
+ CAMERA_CHANGE_VIEW_ALL_SITUATIONS,
+ PED_JUMPING,
+ PED_SPRINT,
+ PED_LOOKBEHIND,
+ VEHICLE_ACCELERATE,
+ VEHICLE_BRAKE,
+ VEHICLE_CHANGE_RADIO_STATION,
+ VEHICLE_HORN,
+ TOGGLE_SUBMISSIONS,
+ VEHICLE_HANDBRAKE,
+ PED_1RST_PERSON_LOOK_LEFT,
+ PED_1RST_PERSON_LOOK_RIGHT,
+ VEHICLE_LOOKLEFT,
+ VEHICLE_LOOKRIGHT,
+ VEHICLE_LOOKBEHIND,
+ VEHICLE_TURRETLEFT,
+ VEHICLE_TURRETRIGHT,
+ VEHICLE_TURRETUP,
+ VEHICLE_TURRETDOWN,
+ PED_CYCLE_TARGET_LEFT,
+ PED_CYCLE_TARGET_RIGHT,
+ PED_CENTER_CAMERA_BEHIND_PLAYER,
+ PED_LOCK_TARGET,
+ NETWORK_TALK,
+ PED_1RST_PERSON_LOOK_UP,
+ PED_1RST_PERSON_LOOK_DOWN,
+ _CONTROLLERACTION_36, // Unused
+ TOGGLE_DPAD,
+ SWITCH_DEBUG_CAM_ON,
+ TAKE_SCREEN_SHOT,
+ SHOW_MOUSE_POINTER_TOGGLE,
+ MAX_CONTROLLERACTIONS,
+};
+
+enum e_ControllerActionType
+{
+ ACTIONTYPE_1RSTPERSON = 0,
+ ACTIONTYPE_3RDPERSON,
+ ACTIONTYPE_VEHICLE,
+ ACTIONTYPE_VEHICLE_3RDPERSON,
+ ACTIONTYPE_COMMON,
+ ACTIONTYPE_1RST3RDPERSON,
+ ACTIONTYPE_NONE,
+};
+
+enum eContSetOrder
+{
+ SETORDER_NONE = 0,
+ SETORDER_1,
+ SETORDER_2,
+ SETORDER_3,
+ SETORDER_4,
+ MAX_SETORDERS,
+};
+
+enum eSimCheckers
+{
+ SIM_X1 = 0, SIM_Y1, // DPad
+ SIM_X2, SIM_Y2, // LeftStick
+
+ MAX_SIMS
};
class CMouseControllerState;
+class CControllerState;
+
+
+#define JOY_BUTTONS 16
+#define MAX_BUTTONS (JOY_BUTTONS+1)
#define ACTIONNAME_LENGTH 40
@@ -72,38 +101,97 @@ class CControllerConfigManager
public:
struct tControllerConfigBind
{
- RsKeyCodes m_Key;
- int32 m_ContSetOrder;
+ int32 m_Key;
+ int32 m_ContSetOrder;
+
+ tControllerConfigBind()
+ {
+ m_Key = 0;
+ m_ContSetOrder = 0;
+ }
};
- bool firstCapture;
- DIJOYSTATE2 m_OldState;
- DIJOYSTATE2 m_NewState;
- wchar m_aActionNames[TOTAL_CONTROL_ACTIONS][ACTIONNAME_LENGTH];
- bool m_aButtonStates[17];
- tControllerConfigBind m_aSettings[TOTAL_CONTROL_ACTIONS][TOTAL_CONTROLLER_TYPES];
- uint8 m_aSimCheckers[4][4];
- bool m_bMouseAssociated;
+ bool m_bFirstCapture;
+ char _pad0[3];
+#ifdef __DINPUT_INCLUDED__
+ DIJOYSTATE2 m_OldState;
+ DIJOYSTATE2 m_NewState;
+#endif
+ wchar m_aActionNames[MAX_CONTROLLERACTIONS][40];
+ bool m_aButtonStates[MAX_BUTTONS];
+ char _pad1[3];
+ tControllerConfigBind m_aSettings[MAX_CONTROLLERACTIONS][MAX_CONTROLLERTYPES];
+ bool m_aSimCheckers[MAX_SIMS][MAX_CONTROLLERTYPES];
+ bool m_bMouseAssociated;
+ char _pad2[3];
- void UpdateJoyButtonState(int padnumber);
- void UpdateJoyInConfigMenus_ButtonDown(int button, int padnumber);
- void AffectControllerStateOn_ButtonDown(int button, eControllerType type);
- void UpdateJoyInConfigMenus_ButtonUp(int button, int padnumber);
- void AffectControllerStateOn_ButtonUp(int button, int padnumber);
+ CControllerConfigManager();
+
+ void MakeControllerActionsBlank();
int32 GetJoyButtonJustDown();
- void LoadSettings(int32 file);
- void SaveSettings(int32 file);
- void MakeControllerActionsBlank();
- void InitDefaultControlConfiguration();
- void InitDefaultControlConfigMouse(CMouseControllerState const &mousestate);
- void InitDefaultControlConfigJoyPad(unsigned int buttons);
- void ClearSimButtonPressCheckers();
- void AffectPadFromKeyBoard();
- void AffectPadFromMouse();
- void ClearSettingsAssociatedWithAction(int, int);
-
- void GetWideStringOfCommandKeys(uint16, wchar*, uint16);
+
+ void SaveSettings(int32 file);
+ void LoadSettings(int32 file);
+
+ void InitDefaultControlConfiguration();
+ void InitDefaultControlConfigMouse(CMouseControllerState const &availableButtons);
+ void InitDefaultControlConfigJoyPad(uint32 buttons);
+ void InitialiseControllerActionNameArray();
+
+ void UpdateJoyInConfigMenus_ButtonDown (int32 button, int32 padnumber);
+ void AffectControllerStateOn_ButtonDown (int32 button, eControllerType type);
+ void AffectControllerStateOn_ButtonDown_Driving (int32 button, eControllerType type, CControllerState &state);
+ void AffectControllerStateOn_ButtonDown_FirstPersonOnly (int32 button, eControllerType type, CControllerState &state);
+ void AffectControllerStateOn_ButtonDown_ThirdPersonOnly (int32 button, eControllerType type, CControllerState &state);
+ void AffectControllerStateOn_ButtonDown_FirstAndThirdPersonOnly (int32 button, eControllerType type, CControllerState &state);
+ void AffectControllerStateOn_ButtonDown_AllStates (int32 button, eControllerType type, CControllerState &state);
+ void AffectControllerStateOn_ButtonDown_VehicleAndThirdPersonOnly(int32 button, eControllerType type, CControllerState &state);
+
+ void UpdateJoyInConfigMenus_ButtonUp(int32 button, int32 padnumber);
+ void AffectControllerStateOn_ButtonUp(int32 button, eControllerType type);
+ void AffectControllerStateOn_ButtonUp_All_Player_States(int32 button, eControllerType type, CControllerState &state);
+
+ void AffectPadFromKeyBoard();
+ void AffectPadFromMouse();
+
+ void ClearSimButtonPressCheckers();
+
+ bool GetIsKeyboardKeyDown (RsKeyCodes keycode);
+ bool GetIsKeyboardKeyJustDown(RsKeyCodes keycode);
+ bool GetIsMouseButtonDown (RsKeyCodes keycode);
+ bool GetIsMouseButtonUp (RsKeyCodes keycode);
+
+
+ void DeleteMatchingCommonControls (e_ControllerAction action, int32 key, eControllerType type);
+ void DeleteMatching3rdPersonControls (e_ControllerAction action, int32 key, eControllerType type);
+ void DeleteMatching1rst3rdPersonControls (e_ControllerAction action, int32 key, eControllerType type);
+ void DeleteMatchingVehicleControls (e_ControllerAction action, int32 key, eControllerType type);
+ void DeleteMatchingVehicle_3rdPersonControls(e_ControllerAction action, int32 key, eControllerType type);
+ void DeleteMatching1rstPersonControls (e_ControllerAction action, int32 key, eControllerType type);
+ void DeleteMatchingActionInitiators (e_ControllerAction action, int32 key, eControllerType type);
+
+ bool GetIsKeyBlank(int32 key, eControllerType type);
+ e_ControllerActionType GetActionType(e_ControllerAction action);
+
+ void ClearSettingsAssociatedWithAction (e_ControllerAction action, eControllerType type);
+ wchar *GetControllerSettingTextWithOrderNumber(e_ControllerAction action, eContSetOrder setorder);
+ wchar *GetControllerSettingTextKeyBoard (e_ControllerAction action, eControllerType type);
+ wchar *GetControllerSettingTextMouse (e_ControllerAction action);
+ wchar *GetControllerSettingTextJoystick (e_ControllerAction action);
+
+ int32 GetNumOfSettingsForAction(e_ControllerAction action);
+ void GetWideStringOfCommandKeys(uint16 action, wchar *text, uint16 leight);
+ int32 GetControllerKeyAssociatedWithAction(e_ControllerAction action, eControllerType type);
+
+ void UpdateJoyButtonState(int32 padnumber);
+
+ bool GetIsActionAButtonCombo (e_ControllerAction action);
+ wchar *GetButtonComboText (e_ControllerAction action);
+ void SetControllerKeyAssociatedWithAction(e_ControllerAction action, int32 key, eControllerType type);
+ int32 GetMouseButtonAssociatedWithAction (e_ControllerAction action);
+ void SetMouseButtonAssociatedWithAction (e_ControllerAction action, int32 button);
+ void ResetSettingOrder (e_ControllerAction action);
};
VALIDATE_SIZE(CControllerConfigManager, 0x143C);