mirror of
https://github.com/isledecomp/isle.git
synced 2026-01-28 18:51:16 +00:00
Style
This commit is contained in:
parent
26955778db
commit
f5c577a2e2
@ -69,11 +69,14 @@ class LegoNotifyListCursor : public MxPtrListCursor<MxCore> {
|
|||||||
class LegoInputManager : public MxPresenter {
|
class LegoInputManager : public MxPresenter {
|
||||||
public:
|
public:
|
||||||
enum Keys {
|
enum Keys {
|
||||||
c_bit1 = 0x01,
|
c_left = 0x01,
|
||||||
c_bit2 = 0x02,
|
c_right = 0x02,
|
||||||
c_bit3 = 0x04,
|
c_up = 0x04,
|
||||||
c_bit4 = 0x08,
|
c_down = 0x08,
|
||||||
c_bit5 = 0x16
|
c_bit5 = 0x10,
|
||||||
|
|
||||||
|
c_leftOrRight = c_left | c_right,
|
||||||
|
c_upOrDown = c_up | c_down
|
||||||
};
|
};
|
||||||
|
|
||||||
LegoInputManager();
|
LegoInputManager();
|
||||||
@ -122,7 +125,7 @@ class LegoInputManager : public MxPresenter {
|
|||||||
MxBool ProcessOneEvent(LegoEventNotificationParam& p_param);
|
MxBool ProcessOneEvent(LegoEventNotificationParam& p_param);
|
||||||
MxBool FUN_1005cdf0(LegoEventNotificationParam& p_param);
|
MxBool FUN_1005cdf0(LegoEventNotificationParam& p_param);
|
||||||
void FUN_1005c0f0();
|
void FUN_1005c0f0();
|
||||||
MxResult FUN_1005c160(MxU32& p_keys);
|
MxResult FUN_1005c160(MxU32& p_keyFlags);
|
||||||
|
|
||||||
// SYNTHETIC: LEGO1 0x1005b8d0
|
// SYNTHETIC: LEGO1 0x1005b8d0
|
||||||
// LegoInputManager::`scalar deleting destructor'
|
// LegoInputManager::`scalar deleting destructor'
|
||||||
@ -144,7 +147,7 @@ class LegoInputManager : public MxPresenter {
|
|||||||
MxBool m_unk0x88; // 0x88
|
MxBool m_unk0x88; // 0x88
|
||||||
IDirectInput* m_directInput; // 0x8c
|
IDirectInput* m_directInput; // 0x8c
|
||||||
IDirectInputDevice* m_directInputDevice; // 0x90
|
IDirectInputDevice* m_directInputDevice; // 0x90
|
||||||
undefined m_unk0x94; // 0x94
|
MxBool m_unk0x94; // 0x94
|
||||||
MxU8 m_unk0x95[256]; // 0x95
|
MxU8 m_unk0x95[256]; // 0x95
|
||||||
MxBool m_unk0x195; // 0x195
|
MxBool m_unk0x195; // 0x195
|
||||||
MxS32 m_joyid; // 0x198
|
MxS32 m_joyid; // 0x198
|
||||||
|
|||||||
@ -524,13 +524,13 @@ MxResult LegoNavController::ProcessKeyboardInput()
|
|||||||
MxBool bool1 = FALSE;
|
MxBool bool1 = FALSE;
|
||||||
MxBool bool2 = FALSE;
|
MxBool bool2 = FALSE;
|
||||||
LegoInputManager* inputManager = LegoOmni::GetInstance()->GetInputManager();
|
LegoInputManager* inputManager = LegoOmni::GetInstance()->GetInputManager();
|
||||||
MxU32 keys;
|
MxU32 p_keyFlags;
|
||||||
|
|
||||||
if (inputManager == NULL || inputManager->FUN_1005c160(keys) == FAILURE) {
|
if (inputManager == NULL || inputManager->FUN_1005c160(p_keyFlags) == FAILURE) {
|
||||||
return FAILURE;
|
return FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (keys == 0) {
|
if (p_keyFlags == 0) {
|
||||||
if (m_unk0x6c) {
|
if (m_unk0x6c) {
|
||||||
m_targetRotationalVel = 0.0;
|
m_targetRotationalVel = 0.0;
|
||||||
m_targetLinearVel = 0.0;
|
m_targetLinearVel = 0.0;
|
||||||
@ -545,10 +545,10 @@ MxResult LegoNavController::ProcessKeyboardInput()
|
|||||||
m_unk0x6c = TRUE;
|
m_unk0x6c = TRUE;
|
||||||
|
|
||||||
MxS32 hMax;
|
MxS32 hMax;
|
||||||
if ((keys & 3) == 1) {
|
if ((p_keyFlags & LegoInputManager::c_leftOrRight) == LegoInputManager::c_left) {
|
||||||
hMax = 0;
|
hMax = 0;
|
||||||
}
|
}
|
||||||
else if ((keys & 3) == 2) {
|
else if ((p_keyFlags & LegoInputManager::c_leftOrRight) == LegoInputManager::c_right) {
|
||||||
hMax = m_hMax;
|
hMax = m_hMax;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -558,10 +558,10 @@ MxResult LegoNavController::ProcessKeyboardInput()
|
|||||||
}
|
}
|
||||||
|
|
||||||
MxS32 vMax;
|
MxS32 vMax;
|
||||||
if ((keys & 12) == 4) {
|
if ((p_keyFlags & LegoInputManager::c_upOrDown) == LegoInputManager::c_up) {
|
||||||
vMax = 0;
|
vMax = 0;
|
||||||
}
|
}
|
||||||
else if ((keys & 12) == 8) {
|
else if ((p_keyFlags & LegoInputManager::c_upOrDown) == LegoInputManager::c_down) {
|
||||||
vMax = m_vMax;
|
vMax = m_vMax;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -570,8 +570,8 @@ MxResult LegoNavController::ProcessKeyboardInput()
|
|||||||
bool2 = TRUE;
|
bool2 = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
MxFloat val = keys & 0x10 ? 1.0f : 4.0f;
|
MxFloat val = p_keyFlags & 0x10 ? 1.0f : 4.0f;
|
||||||
MxFloat val2 = keys & 0x10 ? 1.0f : 2.0f;
|
MxFloat val2 = p_keyFlags & 0x10 ? 1.0f : 2.0f;
|
||||||
|
|
||||||
if (!bool1) {
|
if (!bool1) {
|
||||||
m_targetRotationalVel = CalculateNewTargetVel(hMax, m_hMax / 2, m_maxRotationalVel);
|
m_targetRotationalVel = CalculateNewTargetVel(hMax, m_hMax / 2, m_maxRotationalVel);
|
||||||
|
|||||||
@ -37,7 +37,7 @@ LegoInputManager::LegoInputManager()
|
|||||||
m_unk0x88 = FALSE;
|
m_unk0x88 = FALSE;
|
||||||
m_directInput = NULL;
|
m_directInput = NULL;
|
||||||
m_directInputDevice = NULL;
|
m_directInputDevice = NULL;
|
||||||
m_unk0x94 = 0;
|
m_unk0x94 = FALSE;
|
||||||
m_unk0x195 = 0;
|
m_unk0x195 = 0;
|
||||||
m_joyid = -1;
|
m_joyid = -1;
|
||||||
m_joystickIndex = -1;
|
m_joystickIndex = -1;
|
||||||
@ -141,28 +141,32 @@ void LegoInputManager::ReleaseDX()
|
|||||||
// FUNCTION: LEGO1 0x1005c0f0
|
// FUNCTION: LEGO1 0x1005c0f0
|
||||||
void LegoInputManager::FUN_1005c0f0()
|
void LegoInputManager::FUN_1005c0f0()
|
||||||
{
|
{
|
||||||
m_unk0x94 = 0;
|
m_unk0x94 = FALSE;
|
||||||
|
|
||||||
if (m_directInputDevice) {
|
if (m_directInputDevice) {
|
||||||
HRESULT hr = m_directInputDevice->GetDeviceState(256, &m_unk0x95);
|
HRESULT hr = m_directInputDevice->GetDeviceState(_countof(m_unk0x95), &m_unk0x95);
|
||||||
if (hr == 0x8007001E || hr == 0x8007000c) {
|
|
||||||
|
if (hr == DIERR_INPUTLOST || hr == DIERR_NOTACQUIRED) {
|
||||||
if (m_directInputDevice->Acquire() == S_OK) {
|
if (m_directInputDevice->Acquire() == S_OK) {
|
||||||
hr = m_directInputDevice->GetDeviceState(256, &m_unk0x95);
|
hr = m_directInputDevice->GetDeviceState(_countof(m_unk0x95), &m_unk0x95);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hr == S_OK) {
|
if (hr == S_OK) {
|
||||||
m_unk0x94 = 1;
|
m_unk0x94 = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x1005c160
|
// FUNCTION: LEGO1 0x1005c160
|
||||||
MxResult LegoInputManager::FUN_1005c160(MxU32& p_keys)
|
MxResult LegoInputManager::FUN_1005c160(MxU32& p_keyFlags)
|
||||||
{
|
{
|
||||||
FUN_1005c0f0();
|
FUN_1005c0f0();
|
||||||
|
|
||||||
if (!m_unk0x94) {
|
if (!m_unk0x94) {
|
||||||
return FAILURE;
|
return FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_unk0x100f67b8) {
|
if (g_unk0x100f67b8) {
|
||||||
if (m_unk0x95[DIK_LEFT] & 0x80 && GetAsyncKeyState(VK_LEFT) == 0) {
|
if (m_unk0x95[DIK_LEFT] & 0x80 && GetAsyncKeyState(VK_LEFT) == 0) {
|
||||||
m_unk0x95[DIK_LEFT] = 0;
|
m_unk0x95[DIK_LEFT] = 0;
|
||||||
@ -173,29 +177,29 @@ MxResult LegoInputManager::FUN_1005c160(MxU32& p_keys)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MxU32 value = 0;
|
MxU32 keyFlags = 0;
|
||||||
|
|
||||||
if ((m_unk0x95[DIK_UP] | m_unk0x95[DIK_NUMPAD8]) & 0x80) {
|
if ((m_unk0x95[DIK_NUMPAD8] | m_unk0x95[DIK_UP]) & 0x80) {
|
||||||
value = 4;
|
keyFlags |= c_up;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((m_unk0x95[DIK_NUMPAD2] | m_unk0x95[DIK_DOWN]) & 0x80) {
|
if ((m_unk0x95[DIK_NUMPAD2] | m_unk0x95[DIK_DOWN]) & 0x80) {
|
||||||
value |= 8;
|
keyFlags |= c_down;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((m_unk0x95[DIK_NUMPAD4] | m_unk0x95[DIK_LEFT]) & 0x80) {
|
if ((m_unk0x95[DIK_NUMPAD4] | m_unk0x95[DIK_LEFT]) & 0x80) {
|
||||||
value |= 1;
|
keyFlags |= c_left;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((m_unk0x95[DIK_NUMPAD6] | m_unk0x95[DIK_RIGHT]) & 0x80) {
|
if ((m_unk0x95[DIK_NUMPAD6] | m_unk0x95[DIK_RIGHT]) & 0x80) {
|
||||||
value |= 2;
|
keyFlags |= c_right;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((m_unk0x95[DIK_LCONTROL] | m_unk0x95[DIK_RCONTROL]) & 0x80) {
|
if ((m_unk0x95[DIK_LCONTROL] | m_unk0x95[DIK_RCONTROL]) & 0x80) {
|
||||||
value |= 16;
|
keyFlags |= c_bit5;
|
||||||
}
|
}
|
||||||
|
|
||||||
p_keys = value;
|
p_keyFlags = keyFlags;
|
||||||
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user