Skip to content

Commit 9fe0d84

Browse files
committed
Enhance input settings and improve UI stability
- Adds a new configurable input action to the settings menu. - Increases the size of the input mapping list to accommodate more entries. - Prevents potential crashes by adding a null check when initializing input labels. - Removes the `INPUT_SHIFT` binding from Lua scripts.
1 parent 8caba67 commit 9fe0d84

File tree

4 files changed

+42
-7
lines changed

4 files changed

+42
-7
lines changed

Data/Base.rte/GUIs/SettingsGUI.ini

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1612,7 +1612,7 @@ Parent = CollectionBoxScrollingMappingClipBox
16121612
X = 0
16131613
Y = 0
16141614
Width = 440
1615-
Height = 540
1615+
Height = 585
16161616
Visible = True
16171617
Enabled = True
16181618
Name = CollectionBoxScrollingMappingBox
@@ -2642,6 +2642,36 @@ Anchor = Left, Top
26422642
ToolTip = None
26432643
Text = [InputKey]
26442644

2645+
[LabelInputName35]
2646+
ControlType = LABEL
2647+
Parent = CollectionBoxScrollingMappingBox
2648+
X = 5
2649+
Y = 430
2650+
Width = 110
2651+
Height = 20
2652+
Visible = True
2653+
Enabled = True
2654+
Name = LabelInputName35
2655+
Anchor = Left, Top
2656+
ToolTip = None
2657+
Text = InputName
2658+
HAlignment = right
2659+
VAlignment = middle
2660+
2661+
[ButtonInputKey35]
2662+
ControlType = BUTTON
2663+
Parent = CollectionBoxScrollingMappingBox
2664+
X = 120
2665+
Y = 430
2666+
Width = 95
2667+
Height = 20
2668+
Visible = True
2669+
Enabled = True
2670+
Name = ButtonInputKey35
2671+
Anchor = Left, Top
2672+
ToolTip = None
2673+
Text = [InputKey]
2674+
26452675
[CollectionBoxInputCapture]
26462676
ControlType = COLLECTIONBOX
26472677
Parent = root

Source/Lua/LuaBindingsInput.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ LuaBindingRegisterFunctionDefinitionForType(InputLuaBindings, InputElements) {
4444
luabind::value("INPUT_JUMP", InputElements::INPUT_JUMP),
4545
luabind::value("INPUT_CROUCH", InputElements::INPUT_PRONE), // awful, but script compat
4646
luabind::value("INPUT_PRONE", InputElements::INPUT_PRONE),
47-
luabind::value("INPUT_SHIFT", InputElements::INPUT_SHIFT),
47+
// luabind::value("INPUT_SHIFT", InputElements::INPUT_SHIFT), // Comment out
4848
luabind::value("INPUT_WALKCROUCH", InputElements::INPUT_CROUCH),
4949
luabind::value("INPUT_NEXT", InputElements::INPUT_NEXT),
5050
luabind::value("INPUT_PREV", InputElements::INPUT_PREV),

Source/Menus/SettingsInputMappingGUI.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,15 @@ SettingsInputMappingGUI::SettingsInputMappingGUI(GUIControlManager* parentContro
2828
m_LastInputMapScrollingBoxScrollbarValue = m_InputMapScrollingBoxScrollbar->GetValue();
2929

3030
for (int i = 0; i < InputElements::INPUT_COUNT; ++i) {
31-
m_InputMapLabel[i] = dynamic_cast<GUILabel*>(m_GUIControlManager->GetControl("LabelInputName" + std::to_string(i + 1)));
32-
m_InputMapLabel[i]->SetText(c_InputElementNames[i]);
33-
m_InputMapButton[i] = dynamic_cast<GUIButton*>(m_GUIControlManager->GetControl("ButtonInputKey" + std::to_string(i + 1)));
34-
}
31+
m_InputMapLabel[i] = dynamic_cast<GUILabel*>(m_GUIControlManager->GetControl("LabelInputName" + std::to_string(i + 1)));
32+
33+
// Add null check to prevent crash
34+
if (m_InputMapLabel[i]) {
35+
m_InputMapLabel[i]->SetText(c_InputElementNames[i]);
36+
}
37+
38+
m_InputMapButton[i] = dynamic_cast<GUIButton*>(m_GUIControlManager->GetControl("ButtonInputKey" + std::to_string(i + 1)));
39+
}
3540
m_InputMappingCaptureBox = dynamic_cast<GUICollectionBox*>(m_GUIControlManager->GetControl("CollectionBoxInputCapture"));
3641
m_InputMappingCaptureBox->SetVisible(false);
3742

Source/System/Constants.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ namespace RTE {
220220
INPUT_JUMP,
221221
INPUT_CROUCH,
222222
INPUT_PRONE,
223-
INPUT_SHIFT,
223+
INPUT_SHIFT,
224224
INPUT_NEXT,
225225
INPUT_PREV,
226226
INPUT_WEAPON_CHANGE_NEXT,

0 commit comments

Comments
 (0)