Skip to content

Commit d5555a1

Browse files
committed
use right alt, not ctrl (right ctrl is used for crouching with arrow keys)
1 parent 5269e53 commit d5555a1

File tree

4 files changed

+39
-14
lines changed

4 files changed

+39
-14
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5151
- New `AEmitter` and `PEmitter` INI and Lua (R/W) property `PlayBurstSound` which denotes whether the BurstSound should play when appropriate. This should not be confused for a trigger - it's just a enable/disable toggle to avoid having to remove and add BurstSound altogether.
5252

5353
- Allow lua scripts to use LuaJIT's BitOp module (see https://bitop.luajit.org/api.html)
54-
54+
5555
</details>
5656

5757
<details><summary><b>Changed</b></summary>
@@ -81,7 +81,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
8181

8282
- The `LimbPath` property `NormalTravelSpeed` has been renamed to just `TravelSpeed`.
8383

84-
- All ctrl+* special inputs functionality (i.e restarting activity, world dumps, showing performance stats) are now mapped to right ctrl, to not interfere with default couching input.
84+
- All ctrl+* special inputs functionality (i.e restarting activity, world dumps, showing performance stats) are now mapped to right alt, to not interfere with default couching inputs.
8585

8686
</details>
8787

Source/Lua/LuaBindingsManagers.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,9 +401,14 @@ LuaBindingRegisterFunctionDefinitionForType(ManagerLuaBindings, TimerMan) {
401401
LuaBindingRegisterFunctionDefinitionForType(ManagerLuaBindings, UInputMan) {
402402
return luabind::class_<UInputMan>("UInputManager")
403403

404+
.property("FlagLAltState", &UInputMan::FlagLAltState)
405+
.property("FlagRAltState", &UInputMan::FlagRAltState)
404406
.property("FlagAltState", &UInputMan::FlagAltState)
405-
.property("FlagCtrlState", &UInputMan::FlagCtrlState)
407+
.property("FlagLCtrlState", &UInputMan::FlagLCtrlState)
406408
.property("FlagRCtrlState", &UInputMan::FlagRCtrlState)
409+
.property("FlagCtrlState", &UInputMan::FlagCtrlState)
410+
.property("FlagLShiftState", &UInputMan::FlagLShiftState)
411+
.property("FlagRShiftState", &UInputMan::FlagRShiftState)
407412
.property("FlagShiftState", &UInputMan::FlagShiftState)
408413

409414
.def("GetInputDevice", &UInputMan::GetInputDevice)

Source/Managers/UInputMan.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,7 @@ void UInputMan::HandleSpecialInput() {
875875
return;
876876
}
877877

878-
if (FlagRCtrlState() && !FlagAltState()) {
878+
if (FlagRAltState()) {
879879
// Ctrl+S to save continuous ScreenDumps
880880
if (KeyHeld(SDLK_s)) {
881881
g_FrameMan.SaveScreenToPNG("ScreenDump");
@@ -899,7 +899,7 @@ void UInputMan::HandleSpecialInput() {
899899
g_TimerMan.SetDeltaTimeSecs(c_DefaultDeltaTimeS);
900900
}
901901
}
902-
} else if (!FlagRCtrlState() && FlagAltState()) {
902+
} else if (FlagLAltState()) {
903903
if (KeyPressed(SDLK_F2)) {
904904
ContentFile::ReloadAllBitmaps();
905905
// Alt+Enter to switch resolution multiplier

Source/Managers/UInputMan.h

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -159,21 +159,41 @@ namespace RTE {
159159
/// @return Whether any back buttons have been pressed at all since last frame.
160160
bool AnyBackPress();
161161

162+
/// Gets the state of the Left Ctrl key.
163+
/// @return The state of the Left Ctrl key.
164+
bool FlagLCtrlState() const { return (SDL_GetModState() & KMOD_LCTRL) > 0; }
165+
162166
/// Gets the state of the Right Ctrl key.
163167
/// @return The state of the Right Ctrl key.
164-
bool FlagRCtrlState() const { return ((SDL_GetModState() & KMOD_RCTRL) > 0) ? true : false; }
168+
bool FlagRCtrlState() const { return (SDL_GetModState() & KMOD_RCTRL) > 0; }
165169

166-
/// Gets the state of the Ctrl key.
167-
/// @return The state of the Ctrl key.
168-
bool FlagCtrlState() const { return ((SDL_GetModState() & KMOD_CTRL) > 0) ? true : false; }
170+
/// Gets the state of either Ctrl key.
171+
/// @return The state of either Ctrl key.
172+
bool FlagCtrlState() const { return (SDL_GetModState() & KMOD_CTRL) > 0; }
169173

170-
/// Gets the state of the Alt key.
174+
/// Gets the state of the Left Alt key.
171175
/// @return The state of the Alt key.
172-
bool FlagAltState() const { return ((SDL_GetModState() & KMOD_ALT) > 0) ? true : false; }
176+
bool FlagLAltState() const { return (SDL_GetModState() & KMOD_LALT) > 0; }
177+
178+
/// Gets the state of the Right Alt key.
179+
/// @return The state of the Right Alt key.
180+
bool FlagRAltState() const { return (SDL_GetModState() & KMOD_RALT) > 0; }
181+
182+
/// Gets the state of either Alt key.
183+
/// @return The state of either Alt key.
184+
bool FlagAltState() const { return (SDL_GetModState() & KMOD_ALT) > 0; }
185+
186+
/// Gets the state of the Left Shift key.
187+
/// @return The state of the Left Shift key.
188+
bool FlagLShiftState() const { return (SDL_GetModState() & KMOD_LSHIFT) > 0; }
189+
190+
/// Gets the state of the Right Shift key.
191+
/// @return The state of the Right Shift key.
192+
bool FlagRShiftState() const { return (SDL_GetModState() & KMOD_RSHIFT) > 0; }
173193

174-
/// Gets the state of the Shift key.
175-
/// @return The state of the Shift key.
176-
bool FlagShiftState() const { return ((SDL_GetModState() & KMOD_SHIFT) > 0) ? true : false; }
194+
/// Gets the state of either Shift key.
195+
/// @return The state of either Shift key.
196+
bool FlagShiftState() const { return (SDL_GetModState() & KMOD_SHIFT) > 0; }
177197
#pragma endregion
178198

179199
#pragma region Keyboard Handling

0 commit comments

Comments
 (0)