mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
Add tilde key toggle for auto-run
Pressing ~ toggles auto-run (continuous forward movement). Pressing W or S cancels it. Also cancelled on respawn/teleport.
This commit is contained in:
parent
3bb0096009
commit
eb6e42eb59
2 changed files with 14 additions and 1 deletions
|
|
@ -158,6 +158,8 @@ private:
|
|||
bool xKeyWasDown = false;
|
||||
bool rKeyWasDown = false;
|
||||
bool runPace = false;
|
||||
bool autoRunning = false;
|
||||
bool tildeWasDown = false;
|
||||
|
||||
// Movement state tracking (for sending opcodes on state change)
|
||||
bool wasMovingForward = false;
|
||||
|
|
|
|||
|
|
@ -136,8 +136,18 @@ void CameraController::update(float deltaTime) {
|
|||
keyW = keyS = keyA = keyD = keyQ = keyE = nowJump = false;
|
||||
}
|
||||
|
||||
// Tilde toggles auto-run; any forward/backward key cancels it
|
||||
bool tildeDown = !uiWantsKeyboard && input.isKeyPressed(SDL_SCANCODE_GRAVE);
|
||||
if (tildeDown && !tildeWasDown) {
|
||||
autoRunning = !autoRunning;
|
||||
}
|
||||
tildeWasDown = tildeDown;
|
||||
if (keyW || keyS) {
|
||||
autoRunning = false;
|
||||
}
|
||||
|
||||
bool mouseAutorun = !uiWantsKeyboard && !sitting && leftMouseDown && rightMouseDown;
|
||||
bool nowForward = keyW || mouseAutorun;
|
||||
bool nowForward = keyW || mouseAutorun || autoRunning;
|
||||
bool nowBackward = keyS;
|
||||
bool nowStrafeLeft = false;
|
||||
bool nowStrafeRight = false;
|
||||
|
|
@ -1025,6 +1035,7 @@ void CameraController::reset() {
|
|||
grounded = true;
|
||||
swimming = false;
|
||||
sitting = false;
|
||||
autoRunning = false;
|
||||
|
||||
// Clear edge-state so movement packets can re-start cleanly after respawn.
|
||||
wasMovingForward = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue