Skip to content

Commit f79d08c

Browse files
committed
incomplete but theoretically functional extra weapon hotkey
1 parent ddd82b3 commit f79d08c

File tree

8 files changed

+75
-1
lines changed

8 files changed

+75
-1
lines changed

Data/Base.rte/GUIs/SettingsGUI.ini

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2522,6 +2522,36 @@ Anchor = Left, Top
25222522
ToolTip = None
25232523
Text = [InputKey]
25242524

2525+
[LabelInputName31]
2526+
ControlType = LABEL
2527+
Parent = CollectionBoxScrollingMappingBox
2528+
X = 215
2529+
Y = 380
2530+
Width = 110
2531+
Height = 20
2532+
Visible = True
2533+
Enabled = True
2534+
Name = LabelInputName31
2535+
Anchor = Left, Top
2536+
ToolTip = None
2537+
Text = InputName
2538+
HAlignment = right
2539+
VAlignment = middle
2540+
2541+
[ButtonInputKey31]
2542+
ControlType = BUTTON
2543+
Parent = CollectionBoxScrollingMappingBox
2544+
X = 330
2545+
Y = 380
2546+
Width = 95
2547+
Height = 20
2548+
Visible = True
2549+
Enabled = True
2550+
Name = ButtonInputKey31
2551+
Anchor = Left, Top
2552+
ToolTip = None
2553+
Text = [InputKey]
2554+
25252555
[CollectionBoxInputCapture]
25262556
ControlType = COLLECTIONBOX
25272557
Parent = root

Data/Base.rte/GUIs/SettingsPauseGUI.ini

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2523,6 +2523,36 @@ Anchor = Left, Top
25232523
ToolTip = None
25242524
Text = [InputKey]
25252525

2526+
[LabelInputName31]
2527+
ControlType = LABEL
2528+
Parent = CollectionBoxScrollingMappingBox
2529+
X = 215
2530+
Y = 380
2531+
Width = 110
2532+
Height = 20
2533+
Visible = True
2534+
Enabled = True
2535+
Name = LabelInputName31
2536+
Anchor = Left, Top
2537+
ToolTip = None
2538+
Text = InputName
2539+
HAlignment = right
2540+
VAlignment = middle
2541+
2542+
[ButtonInputKey31]
2543+
ControlType = BUTTON
2544+
Parent = CollectionBoxScrollingMappingBox
2545+
X = 330
2546+
Y = 380
2547+
Width = 95
2548+
Height = 20
2549+
Visible = True
2550+
Enabled = True
2551+
Name = ButtonInputKey31
2552+
Anchor = Left, Top
2553+
ToolTip = None
2554+
Text = [InputKey]
2555+
25262556
[CollectionBoxInputCapture]
25272557
ControlType = COLLECTIONBOX
25282558
Parent = root

Data/Browncoats.rte/Actors/Turrets/Thunderer/ThundererGun.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
function OnFire(self)
2-
CameraMan:AddScreenShake(7, self.Pos);
2+
CameraMan:AddScreenShake(12, self.Pos);
33

44
local shot = self.Shot:Clone();
55
shot.Pos = self.MuzzlePos;

Source/Lua/LuaBindingsSystem.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ LuaBindingRegisterFunctionDefinitionForType(SystemLuaBindings, Controller) {
8080
luabind::value("WEAPON_CHANGE_PREV", ControlState::WEAPON_CHANGE_PREV),
8181
luabind::value("WEAPON_PICKUP", ControlState::WEAPON_PICKUP),
8282
luabind::value("WEAPON_DROP", ControlState::WEAPON_DROP),
83+
luabind::value("WEAPON_PRIMARY_HOTKEY", ControlState::WEAPON_PRIMARY_HOTKEY),
8384
luabind::value("ACTOR_NEXT", ControlState::ACTOR_NEXT),
8485
luabind::value("ACTOR_PREV", ControlState::ACTOR_PREV),
8586
luabind::value("ACTOR_BRAIN", ControlState::ACTOR_BRAIN),

Source/System/Constants.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ namespace RTE {
219219
INPUT_WEAPON_PICKUP,
220220
INPUT_WEAPON_DROP,
221221
INPUT_WEAPON_RELOAD,
222+
INPUT_WEAPON_PRIMARY_HOTKEY,
222223
INPUT_START,
223224
INPUT_BACK,
224225
INPUT_R_UP,
@@ -253,6 +254,7 @@ namespace RTE {
253254
"Pick Up Device", // INPUT_WEAPON_PICKUP
254255
"Drop Device", // INPUT_WEAPON_DROP
255256
"Reload Weapon", // INPUT_WEAPON_RELOAD
257+
"Primary Weapon Hotkey", // INPUT_WEAPON_PRIMARY_HOTKEY
256258
"Start", // INPUT_START
257259
"Back", // INPUT_BACK
258260
"Analog Aim Up", // INPUT_R_UP

Source/System/Controller.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ void Controller::Clear() {
2626
m_WeaponPickupIgnore = false;
2727
m_WeaponDropIgnore = false;
2828
m_WeaponReloadIgnore = false;
29+
m_WeaponPrimaryHotkeyIgnore = false;
2930
m_MouseMovement.Reset();
3031
m_AnalogCursorAngleLimits = {{0, 0}, false};
3132
m_ReleaseTimer.Reset();
@@ -251,6 +252,8 @@ void Controller::UpdatePlayerInput(std::array<bool, ControlState::CONTROLSTATECO
251252
m_WeaponDropIgnore = false;
252253
} else if (g_UInputMan.ElementReleased(m_Player, InputElements::INPUT_WEAPON_RELOAD)) {
253254
m_WeaponReloadIgnore = false;
255+
} else if (g_UInputMan.ElementReleased(m_Player, InputElements::INPUT_WEAPON_PRIMARY_HOTKEY)) {
256+
m_WeaponPrimaryHotkeyIgnore = false;
254257
}
255258

256259
m_ControlStates[ControlState::HOLD_RIGHT] = g_UInputMan.ElementHeld(m_Player, InputElements::INPUT_L_RIGHT) || g_UInputMan.ElementHeld(m_Player, InputElements::INPUT_AIM_RIGHT);
@@ -351,6 +354,10 @@ void Controller::UpdatePlayerPieMenuInput(std::array<bool, ControlState::CONTROL
351354
m_ControlStates[ControlState::WEAPON_RELOAD] = true;
352355
m_WeaponReloadIgnore = true;
353356
}
357+
if (!m_WeaponPrimaryHotkeyIgnore && g_UInputMan.ElementPressed(m_Player, InputElements::INPUT_WEAPON_PRIMARY_HOTKEY)) {
358+
m_ControlStates[ControlState::WEAPON_PRIMARY_HOTKEY] = true;
359+
m_WeaponPrimaryHotkeyIgnore = true;
360+
}
354361
}
355362

356363
// PIE MENU ACTIVE

Source/System/Controller.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ namespace RTE {
4141
WEAPON_CHANGE_PREV,
4242
WEAPON_PICKUP,
4343
WEAPON_DROP,
44+
WEAPON_PRIMARY_HOTKEY,
4445
ACTOR_NEXT,
4546
ACTOR_PREV,
4647
ACTOR_BRAIN,
@@ -329,6 +330,7 @@ namespace RTE {
329330
bool m_WeaponPickupIgnore;
330331
bool m_WeaponDropIgnore;
331332
bool m_WeaponReloadIgnore;
333+
bool m_WeaponPrimaryHotkeyIgnore;
332334

333335
Timer m_ReleaseTimer; //!< Timer for measuring release delays.
334336
Timer m_JoyAccelTimer; //!< Timer for measuring analog joystick-controlled cursor acceleration.

Source/System/InputScheme.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ int InputScheme::ReadProperty(const std::string_view& propName, Reader& reader)
5959
MatchProperty("WeaponPickup", { reader >> m_InputMappings[InputElements::INPUT_WEAPON_PICKUP]; });
6060
MatchProperty("WeaponDrop", { reader >> m_InputMappings[InputElements::INPUT_WEAPON_DROP]; });
6161
MatchProperty("WeaponReload", { reader >> m_InputMappings[InputElements::INPUT_WEAPON_RELOAD]; });
62+
MatchProperty("WeaponPrimaryHotkey", { reader >> m_InputMappings[InputElements::INPUT_WEAPON_PRIMARY_HOTKEY]; });
6263
MatchProperty("Start", { reader >> m_InputMappings[InputElements::INPUT_START]; });
6364
MatchProperty("Back", { reader >> m_InputMappings[InputElements::INPUT_BACK]; });
6465
MatchProperty("RightUp", { reader >> m_InputMappings[InputElements::INPUT_R_UP]; });
@@ -222,6 +223,7 @@ void InputScheme::SetPreset(InputPreset schemePreset) {
222223
m_InputMappings[InputElements::INPUT_WEAPON_DROP].SetKey(SDL_SCANCODE_G);
223224
m_InputMappings[InputElements::INPUT_WEAPON_CHANGE_PREV].SetKey(SDL_SCANCODE_1);
224225
m_InputMappings[InputElements::INPUT_WEAPON_CHANGE_NEXT].SetKey(SDL_SCANCODE_2);
226+
m_InputMappings[InputElements::INPUT_WEAPON_PRIMARY_HOTKEY].SetMouseButton(MOUSE_MIDDLE);
225227
break;
226228
case InputPreset::PresetGenericDPad:
227229
// TODO: Don't have any SNES style controllers to test with so no idea what would work or make sense here.

0 commit comments

Comments
 (0)