re3/src/core/ControllerConfig.h

201 lines
6.4 KiB
C
Raw Normal View History

2019-05-31 17:02:26 +00:00
#pragma once
// based on x-gtasa
enum eControllerType
{
2019-10-27 03:17:30 +00:00
KEYBOARD = 0,
2019-05-31 17:02:26 +00:00
OPTIONAL_EXTRA,
MOUSE,
JOYSTICK,
2019-10-27 03:17:30 +00:00
MAX_CONTROLLERTYPES,
2019-10-20 22:08:26 +00:00
};
2019-10-27 03:17:30 +00:00
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
2019-05-31 17:02:26 +00:00
};
class CMouseControllerState;
2019-10-27 03:17:30 +00:00
class CControllerState;
#define JOY_BUTTONS 16
#define MAX_BUTTONS (JOY_BUTTONS+1)
2019-10-20 22:08:26 +00:00
#define ACTIONNAME_LENGTH 40
2019-05-31 17:02:26 +00:00
class CControllerConfigManager
{
public:
struct tControllerConfigBind
{
2019-10-27 03:17:30 +00:00
int32 m_Key;
int32 m_ContSetOrder;
tControllerConfigBind()
{
m_Key = 0;
m_ContSetOrder = 0;
}
2019-05-31 17:02:26 +00:00
};
2019-10-27 03:17:30 +00:00
bool m_bFirstCapture;
2019-05-31 17:02:26 +00:00
char _pad0[3];
2019-10-27 03:17:30 +00:00
#ifdef __DINPUT_INCLUDED__
DIJOYSTATE2 m_OldState;
DIJOYSTATE2 m_NewState;
2020-02-06 17:35:24 +00:00
#else
uint8 ___padd[0x110 * 2];
2019-10-27 03:17:30 +00:00
#endif
2019-10-27 11:46:58 +00:00
wchar m_aActionNames[MAX_CONTROLLERACTIONS][ACTIONNAME_LENGTH];
2019-10-27 03:17:30 +00:00
bool m_aButtonStates[MAX_BUTTONS];
2019-05-31 17:02:26 +00:00
char _pad1[3];
2019-10-27 03:17:30 +00:00
tControllerConfigBind m_aSettings[MAX_CONTROLLERACTIONS][MAX_CONTROLLERTYPES];
bool m_aSimCheckers[MAX_SIMS][MAX_CONTROLLERTYPES];
bool m_bMouseAssociated;
2019-05-31 17:02:26 +00:00
char _pad2[3];
2019-10-27 03:17:30 +00:00
CControllerConfigManager();
void MakeControllerActionsBlank();
2019-05-31 17:02:26 +00:00
2019-06-16 22:16:38 +00:00
int32 GetJoyButtonJustDown();
2019-10-27 03:17:30 +00:00
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();
2019-07-10 07:57:08 +00:00
2019-10-27 03:17:30 +00:00
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);
2019-05-31 17:02:26 +00:00
};
VALIDATE_SIZE(CControllerConfigManager, 0x143C);
extern CControllerConfigManager &ControlsManager;