diff --git a/LEGO1/lego/legoomni/include/legoinputmanager.h b/LEGO1/lego/legoomni/include/legoinputmanager.h index 9b47d7a8..a199d7d7 100644 --- a/LEGO1/lego/legoomni/include/legoinputmanager.h +++ b/LEGO1/lego/legoomni/include/legoinputmanager.h @@ -74,7 +74,7 @@ public: c_right = 0x02, c_up = 0x04, c_down = 0x08, - c_bit5 = 0x10, + c_ctrl = 0x10, c_leftOrRight = c_left | c_right, c_upOrDown = c_up | c_down diff --git a/LEGO1/lego/legoomni/include/legonavcontroller.h b/LEGO1/lego/legoomni/include/legonavcontroller.h index ef882450..adbed6a1 100644 --- a/LEGO1/lego/legoomni/include/legonavcontroller.h +++ b/LEGO1/lego/legoomni/include/legonavcontroller.h @@ -155,7 +155,7 @@ protected: float m_unk0x60; // 0x60 float m_unk0x64; // 0x64 float m_unk0x68; // 0x68 - MxBool m_unk0x6c; // 0x6c + MxBool m_isAccelerating; // 0x6c // one copy of defaults (these can be set by App.) static int g_defdeadZone; diff --git a/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp index 24ea5af5..061ffdd6 100644 --- a/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp +++ b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp @@ -135,7 +135,7 @@ LegoNavController::LegoNavController() m_rotationalAccel = 0.0f; m_trackDefault = FALSE; m_unk0x5d = FALSE; - m_unk0x6c = FALSE; + m_isAccelerating = FALSE; m_unk0x64 = 0.0f; m_unk0x68 = 0.0f; m_unk0x60 = 0.0f; @@ -564,8 +564,8 @@ MxResult LegoNavController::ProcessJoystickInput(MxBool& p_und) // FUNCTION: LEGO1 0x100558b0 MxResult LegoNavController::ProcessKeyboardInput() { - MxBool bool1 = FALSE; - MxBool bool2 = FALSE; + MxBool skipRotationVelAndAccelCalc = FALSE; + MxBool skipLinearVelAndAccelCalc = FALSE; LegoInputManager* inputManager = LegoOmni::GetInstance()->GetInputManager(); MxU32 keyFlags; @@ -574,18 +574,18 @@ MxResult LegoNavController::ProcessKeyboardInput() } if (keyFlags == 0) { - if (m_unk0x6c) { + if (m_isAccelerating) { m_targetRotationalVel = 0.0; m_targetLinearVel = 0.0; m_rotationalAccel = m_maxRotationalDeccel; m_linearAccel = m_maxLinearDeccel; - m_unk0x6c = FALSE; + m_isAccelerating = FALSE; } return FAILURE; } - m_unk0x6c = TRUE; + m_isAccelerating = TRUE; MxS32 hMax; switch (keyFlags & LegoInputManager::c_leftOrRight) { @@ -598,7 +598,7 @@ MxResult LegoNavController::ProcessKeyboardInput() default: m_targetRotationalVel = 0.0; m_rotationalAccel = m_maxRotationalDeccel; - bool1 = TRUE; + skipRotationVelAndAccelCalc = TRUE; break; } @@ -613,23 +613,31 @@ MxResult LegoNavController::ProcessKeyboardInput() default: m_targetLinearVel = 0.0; m_linearAccel = m_maxLinearDeccel; - bool2 = TRUE; + skipLinearVelAndAccelCalc = TRUE; break; } - MxFloat val = keyFlags & LegoInputManager::c_bit5 ? 1.0f : 4.0f; - MxFloat val2 = keyFlags & LegoInputManager::c_bit5 ? 1.0f : 2.0f; + MxFloat maxAccelDivisor = keyFlags & LegoInputManager::c_ctrl ? 1.0f : 4.0f; + MxFloat minAccelDivisor = keyFlags & LegoInputManager::c_ctrl ? 1.0f : 2.0f; - if (!bool1) { + if (!skipRotationVelAndAccelCalc) { m_targetRotationalVel = CalculateNewTargetVel(hMax, m_hMax / 2, m_maxRotationalVel); - m_rotationalAccel = - CalculateNewAccel(hMax, m_hMax / 2, m_maxRotationalAccel / val, (int) (m_minRotationalAccel / val2)); + m_rotationalAccel = CalculateNewAccel( + hMax, + m_hMax / 2, + m_maxRotationalAccel / maxAccelDivisor, + (int) (m_minRotationalAccel / minAccelDivisor) + ); } - if (!bool2) { + if (!skipLinearVelAndAccelCalc) { m_targetLinearVel = CalculateNewTargetVel(m_vMax - vMax, m_vMax / 2, m_maxLinearVel); - m_linearAccel = - CalculateNewAccel(m_vMax - vMax, m_vMax / 2, m_maxLinearAccel / val, (int) (m_minLinearAccel / val2)); + m_linearAccel = CalculateNewAccel( + m_vMax - vMax, + m_vMax / 2, + m_maxLinearAccel / maxAccelDivisor, + (int) (m_minLinearAccel / minAccelDivisor) + ); } return SUCCESS; diff --git a/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp b/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp index e3523ca9..f3c7a9d3 100644 --- a/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp +++ b/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp @@ -195,7 +195,7 @@ MxResult LegoInputManager::GetNavigationKeyStates(MxU32& p_keyFlags) } if ((m_keyboardState[DIK_LCONTROL] | m_keyboardState[DIK_RCONTROL]) & 0x80) { - keyFlags |= c_bit5; + keyFlags |= c_ctrl; } p_keyFlags = keyFlags;