Merge pull request #278 from Fire-Head/master

fixed mouse binding
This commit is contained in:
erorcun 2019-12-02 22:37:45 +03:00 committed by GitHub
commit eea84b86b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1443,39 +1443,36 @@ bool CControllerConfigManager::GetIsMouseButtonDown(RsKeyCodes keycode)
bool CControllerConfigManager::GetIsMouseButtonUp(RsKeyCodes keycode) bool CControllerConfigManager::GetIsMouseButtonUp(RsKeyCodes keycode)
{ {
if (keycode > rsMOUSEX2BUTTON) switch (keycode)
{ {
switch (keycode) case rsMOUSELEFTBUTTON:
{ if (CPad::GetPad(PAD1)->GetLeftMouseUp())
case rsMOUSELEFTBUTTON: return true;
if (CPad::GetPad(PAD1)->GetLeftMouseUp()) break;
return true; case rsMOUSMIDDLEBUTTON:
break; if (CPad::GetPad(PAD1)->GetMiddleMouseUp())
case rsMOUSMIDDLEBUTTON: return true;
if (CPad::GetPad(PAD1)->GetMiddleMouseUp()) break;
return true; case rsMOUSERIGHTBUTTON:
break; if (CPad::GetPad(PAD1)->GetRightMouseUp())
case rsMOUSERIGHTBUTTON: return true;
if (CPad::GetPad(PAD1)->GetRightMouseUp()) break;
return true; case rsMOUSEWHEELUPBUTTON:
break; if (CPad::GetPad(PAD1)->GetMouseWheelUpUp())
case rsMOUSEWHEELUPBUTTON: return true;
if (CPad::GetPad(PAD1)->GetMouseWheelUpUp()) break;
return true; case rsMOUSEWHEELDOWNBUTTON:
break; if (CPad::GetPad(PAD1)->GetMouseWheelDownUp())
case rsMOUSEWHEELDOWNBUTTON: return true;
if (CPad::GetPad(PAD1)->GetMouseWheelDownUp()) break;
return true; case rsMOUSEX1BUTTON:
break; if (CPad::GetPad(PAD1)->GetMouseX1Up())
case rsMOUSEX1BUTTON: return true;
if (CPad::GetPad(PAD1)->GetMouseX1Up()) break;
return true; case rsMOUSEX2BUTTON:
break; if (CPad::GetPad(PAD1)->GetMouseX2Up())
case rsMOUSEX2BUTTON: return true;
if (CPad::GetPad(PAD1)->GetMouseX2Up()) break;
return true;
break;
}
} }
return false; return false;
@ -1662,9 +1659,6 @@ void CControllerConfigManager::DeleteMatchingActionInitiators(e_ControllerAction
bool CControllerConfigManager::GetIsKeyBlank(int32 key, eControllerType type) bool CControllerConfigManager::GetIsKeyBlank(int32 key, eControllerType type)
{ {
if (type > JOYSTICK)
return true;
switch (type) switch (type)
{ {
case KEYBOARD: case KEYBOARD:
@ -1755,27 +1749,24 @@ e_ControllerActionType CControllerConfigManager::GetActionType(e_ControllerActio
void CControllerConfigManager::ClearSettingsAssociatedWithAction(e_ControllerAction action, eControllerType type) void CControllerConfigManager::ClearSettingsAssociatedWithAction(e_ControllerAction action, eControllerType type)
{ {
if (type <= JOYSTICK) switch (type)
{ {
switch (type) case KEYBOARD:
{ m_aSettings[action][type].m_Key = rsNULL;
case KEYBOARD: m_aSettings[action][type].m_ContSetOrder = SETORDER_NONE;
m_aSettings[action][type].m_Key = rsNULL; break;
m_aSettings[action][type].m_ContSetOrder = SETORDER_NONE; case OPTIONAL_EXTRA:
break; m_aSettings[action][type].m_Key = rsNULL;
case OPTIONAL_EXTRA: m_aSettings[action][type].m_ContSetOrder = SETORDER_NONE;
m_aSettings[action][type].m_Key = rsNULL; break;
m_aSettings[action][type].m_ContSetOrder = SETORDER_NONE; case MOUSE:
break; m_aSettings[action][type].m_Key = 0;
case MOUSE: m_aSettings[action][type].m_ContSetOrder = SETORDER_NONE;
m_aSettings[action][type].m_Key = 0; break;
m_aSettings[action][type].m_ContSetOrder = SETORDER_NONE; case JOYSTICK:
break; m_aSettings[action][type].m_Key = 0;
case JOYSTICK: m_aSettings[action][type].m_ContSetOrder = SETORDER_NONE;
m_aSettings[action][type].m_Key = 0; break;
m_aSettings[action][type].m_ContSetOrder = SETORDER_NONE;
break;
}
} }
ResetSettingOrder(action); ResetSettingOrder(action);
@ -2257,6 +2248,7 @@ void CControllerConfigManager::UpdateJoyButtonState(int32 padnumber)
for (int32 i = 0; i < MAX_BUTTONS; i++) for (int32 i = 0; i < MAX_BUTTONS; i++)
m_aButtonStates[i] = false; m_aButtonStates[i] = false;
#ifdef __DINPUT_INCLUDED__
for (int32 i = 0; i < MAX_BUTTONS; i++) for (int32 i = 0; i < MAX_BUTTONS; i++)
{ {
if (m_NewState.rgbButtons[i] & 0x80) if (m_NewState.rgbButtons[i] & 0x80)
@ -2264,6 +2256,7 @@ void CControllerConfigManager::UpdateJoyButtonState(int32 padnumber)
else else
m_aButtonStates[i] = false; m_aButtonStates[i] = false;
} }
#endif
} }
bool CControllerConfigManager::GetIsActionAButtonCombo(e_ControllerAction action) bool CControllerConfigManager::GetIsActionAButtonCombo(e_ControllerAction action)
@ -2412,4 +2405,4 @@ STARTPATCHES
InjectHook(0x58F740, &CControllerConfigManager::GetMouseButtonAssociatedWithAction, PATCH_JUMP); InjectHook(0x58F740, &CControllerConfigManager::GetMouseButtonAssociatedWithAction, PATCH_JUMP);
InjectHook(0x58F760, &CControllerConfigManager::SetMouseButtonAssociatedWithAction, PATCH_JUMP); InjectHook(0x58F760, &CControllerConfigManager::SetMouseButtonAssociatedWithAction, PATCH_JUMP);
InjectHook(0x58F790, &CControllerConfigManager::ResetSettingOrder, PATCH_JUMP); InjectHook(0x58F790, &CControllerConfigManager::ResetSettingOrder, PATCH_JUMP);
ENDPATCHES ENDPATCHES