2021-01-02 01:49:45 -05:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
namespace Components
|
|
|
|
{
|
|
|
|
class XInput : public Component
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
XInput();
|
|
|
|
|
2021-05-02 07:13:13 -04:00
|
|
|
struct ActionMapping {
|
|
|
|
int input;
|
|
|
|
std::string action;
|
|
|
|
bool isReversible;
|
|
|
|
bool wasPressed = false;
|
|
|
|
bool spamWhenHeld = false;
|
|
|
|
|
|
|
|
ActionMapping(int input, std::string action, bool isReversible = true, bool spamWhenHeld = false)
|
|
|
|
{
|
|
|
|
this->action = action;
|
|
|
|
this->isReversible = isReversible;
|
|
|
|
this->input = input;
|
|
|
|
this->spamWhenHeld = spamWhenHeld;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-05-04 09:47:46 -04:00
|
|
|
struct MenuMapping {
|
|
|
|
int input;
|
|
|
|
Game::keyNum_t keystroke;
|
|
|
|
bool wasPressed = false;
|
|
|
|
|
|
|
|
MenuMapping(int input, Game::keyNum_t keystroke)
|
|
|
|
{
|
|
|
|
this->keystroke = keystroke;
|
|
|
|
this->input = input;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-01-02 01:49:45 -05:00
|
|
|
private:
|
2021-01-02 02:17:37 -05:00
|
|
|
static XINPUT_STATE xiStates[XUSER_MAX_COUNT];
|
2021-01-02 14:42:52 -05:00
|
|
|
static int xiPlayerNum;
|
2021-05-02 07:13:13 -04:00
|
|
|
static XINPUT_STATE lastXiState;
|
|
|
|
|
|
|
|
static bool isHoldingMaxLookX;
|
|
|
|
static std::chrono::milliseconds timeAtFirstHeldMaxLookX;
|
2021-05-04 15:45:47 -04:00
|
|
|
static bool isADS;
|
2021-05-02 07:13:13 -04:00
|
|
|
|
2021-05-04 09:47:46 -04:00
|
|
|
static std::chrono::milliseconds lastNavigationTime;
|
|
|
|
static std::chrono::milliseconds msBetweenNavigations;
|
|
|
|
static float lastMenuNavigationDirection;
|
|
|
|
|
2021-05-04 12:09:37 -04:00
|
|
|
static void CL_GetMouseMovementCl(Game::clientActive_t* result, float* mx, float* my);
|
|
|
|
|
|
|
|
static void MouseOverride(Game::clientActive_t* clientActive, float* my, float* mx);
|
|
|
|
static char MovementOverride(int a1, Game::usercmd_s* cmd);
|
2021-05-02 07:13:13 -04:00
|
|
|
static void Vibrate(int leftVal = 0, int rightVal = 0);
|
2021-01-02 02:17:37 -05:00
|
|
|
|
|
|
|
static void CL_FrameStub();
|
|
|
|
static void PollXInputDevices();
|
|
|
|
|
|
|
|
static void CL_CreateCmdStub();
|
|
|
|
static void CL_GamepadMove(int, Game::usercmd_s*);
|
2021-05-04 09:47:46 -04:00
|
|
|
static void MenuNavigate();
|
2021-01-02 17:48:48 -05:00
|
|
|
|
|
|
|
static void MSG_WriteDeltaUsercmdKeyStub();
|
|
|
|
|
2021-01-02 20:06:40 -05:00
|
|
|
static void ApplyMovement(Game::msg_t* msg, int key, Game::usercmd_s* from, Game::usercmd_s* to);
|
|
|
|
|
2021-01-02 17:48:48 -05:00
|
|
|
static void MSG_ReadDeltaUsercmdKeyStub();
|
2021-01-02 18:37:46 -05:00
|
|
|
static void MSG_ReadDeltaUsercmdKeyStub2();
|
|
|
|
};
|
2021-01-02 01:49:45 -05:00
|
|
|
}
|