mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
fix(input): block WASD and Q/E movement
This commit is contained in:
parent
565c78d141
commit
8391f93ca6
2 changed files with 7 additions and 8 deletions
|
|
@ -225,13 +225,17 @@ void CameraController::update(float deltaTime) {
|
||||||
bool keyD = !uiWantsKeyboard && !sitting && !movementSuppressed && input.isKeyPressed(SDL_SCANCODE_D);
|
bool keyD = !uiWantsKeyboard && !sitting && !movementSuppressed && input.isKeyPressed(SDL_SCANCODE_D);
|
||||||
bool keyQ = !uiWantsKeyboard && !sitting && !movementSuppressed && input.isKeyPressed(SDL_SCANCODE_Q);
|
bool keyQ = !uiWantsKeyboard && !sitting && !movementSuppressed && input.isKeyPressed(SDL_SCANCODE_Q);
|
||||||
bool keyE = !uiWantsKeyboard && !sitting && !movementSuppressed && input.isKeyPressed(SDL_SCANCODE_E);
|
bool keyE = !uiWantsKeyboard && !sitting && !movementSuppressed && input.isKeyPressed(SDL_SCANCODE_E);
|
||||||
|
|
||||||
|
// Keyboard movement keys are blocked (movement only).
|
||||||
|
// Mouse autorun (L+R) and other non-movement keys remain functional.
|
||||||
|
keyW = keyS = keyA = keyD = keyQ = keyE = false;
|
||||||
bool shiftDown = !uiWantsKeyboard && (input.isKeyPressed(SDL_SCANCODE_LSHIFT) || input.isKeyPressed(SDL_SCANCODE_RSHIFT));
|
bool shiftDown = !uiWantsKeyboard && (input.isKeyPressed(SDL_SCANCODE_LSHIFT) || input.isKeyPressed(SDL_SCANCODE_RSHIFT));
|
||||||
bool ctrlDown = !uiWantsKeyboard && (input.isKeyPressed(SDL_SCANCODE_LCTRL) || input.isKeyPressed(SDL_SCANCODE_RCTRL));
|
bool ctrlDown = !uiWantsKeyboard && (input.isKeyPressed(SDL_SCANCODE_LCTRL) || input.isKeyPressed(SDL_SCANCODE_RCTRL));
|
||||||
bool nowJump = !uiWantsKeyboard && !sitting && !movementSuppressed && input.isKeyJustPressed(SDL_SCANCODE_SPACE);
|
bool nowJump = !uiWantsKeyboard && !sitting && !movementSuppressed && input.isKeyJustPressed(SDL_SCANCODE_SPACE);
|
||||||
bool spaceDown = !uiWantsKeyboard && !sitting && !movementSuppressed && input.isKeyPressed(SDL_SCANCODE_SPACE);
|
bool spaceDown = !uiWantsKeyboard && !sitting && !movementSuppressed && input.isKeyPressed(SDL_SCANCODE_SPACE);
|
||||||
|
|
||||||
// Idle camera: any input resets the timer; timeout triggers a slow orbit pan
|
// Idle camera: any input resets the timer; timeout triggers a slow orbit pan
|
||||||
bool anyInput = leftMouseDown || rightMouseDown || keyW || keyS || keyA || keyD || keyQ || keyE || nowJump;
|
bool anyInput = leftMouseDown || rightMouseDown || nowJump;
|
||||||
if (anyInput) {
|
if (anyInput) {
|
||||||
idleTimer_ = 0.0f;
|
idleTimer_ = 0.0f;
|
||||||
} else if (!introActive) {
|
} else if (!introActive) {
|
||||||
|
|
@ -397,11 +401,7 @@ void CameraController::update(float deltaTime) {
|
||||||
|
|
||||||
// Stand up on any movement key or jump while sitting (WoW behaviour)
|
// Stand up on any movement key or jump while sitting (WoW behaviour)
|
||||||
if (!uiWantsKeyboard && sitting && !movementSuppressed) {
|
if (!uiWantsKeyboard && sitting && !movementSuppressed) {
|
||||||
bool anyMoveKey =
|
bool anyMoveKey = input.isKeyPressed(SDL_SCANCODE_SPACE);
|
||||||
input.isKeyPressed(SDL_SCANCODE_W) || input.isKeyPressed(SDL_SCANCODE_S) ||
|
|
||||||
input.isKeyPressed(SDL_SCANCODE_A) || input.isKeyPressed(SDL_SCANCODE_D) ||
|
|
||||||
input.isKeyPressed(SDL_SCANCODE_Q) || input.isKeyPressed(SDL_SCANCODE_E) ||
|
|
||||||
input.isKeyPressed(SDL_SCANCODE_SPACE);
|
|
||||||
if (anyMoveKey) sitting = false;
|
if (anyMoveKey) sitting = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -460,8 +460,7 @@ void PerformanceHUD::render(const Renderer* renderer, const Camera* camera) {
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
|
||||||
ImGui::TextColored(ImVec4(0.8f, 0.8f, 0.5f, 1.0f), "Movement");
|
ImGui::TextColored(ImVec4(0.8f, 0.8f, 0.5f, 1.0f), "Movement");
|
||||||
ImGui::TextColored(ImVec4(0.6f, 0.6f, 0.6f, 1.0f), "WASD: Move/Strafe");
|
ImGui::TextColored(ImVec4(0.6f, 0.6f, 0.6f, 1.0f), "WASD/QE: Blocked");
|
||||||
ImGui::TextColored(ImVec4(0.6f, 0.6f, 0.6f, 1.0f), "Q/E: Strafe left/right");
|
|
||||||
ImGui::TextColored(ImVec4(0.6f, 0.6f, 0.6f, 1.0f), "Space: Jump");
|
ImGui::TextColored(ImVec4(0.6f, 0.6f, 0.6f, 1.0f), "Space: Jump");
|
||||||
ImGui::TextColored(ImVec4(0.6f, 0.6f, 0.6f, 1.0f), "X: Sit/Stand");
|
ImGui::TextColored(ImVec4(0.6f, 0.6f, 0.6f, 1.0f), "X: Sit/Stand");
|
||||||
ImGui::TextColored(ImVec4(0.6f, 0.6f, 0.6f, 1.0f), "~: Auto-run");
|
ImGui::TextColored(ImVec4(0.6f, 0.6f, 0.6f, 1.0f), "~: Auto-run");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue