feat: re-enable R key for camera reset with chat input safeguard

Allow R key to reset camera position/rotation when chat input is not active.
Previously disabled due to conflict with chat reply command. Now uses the same
safety check as movement keys (ImGui::GetIO().WantTextInput).

Implements edge-triggered reset on R key press, matching X key (sit) pattern.
This commit is contained in:
Kelsi 2026-03-11 07:53:36 -07:00
parent a3e0d36a72
commit a8fd977a53

View file

@ -377,6 +377,13 @@ void CameraController::update(float deltaTime) {
if (mounted_) sitting = false;
xKeyWasDown = xDown;
// Reset camera with R key (edge-triggered) — only when UI doesn't want keyboard
bool rDown = !uiWantsKeyboard && input.isKeyPressed(SDL_SCANCODE_R);
if (rDown && !rKeyWasDown) {
reset();
}
rKeyWasDown = rDown;
// Stand up on any movement key or jump while sitting (WoW behaviour)
if (!uiWantsKeyboard && sitting && !movementSuppressed) {
bool anyMoveKey =
@ -1851,8 +1858,7 @@ void CameraController::update(float deltaTime) {
wasJumping = nowJump;
wasFalling = !grounded && verticalVelocity <= 0.0f;
// R key disabled — was camera reset, conflicts with chat reply
rKeyWasDown = false;
// R key is now handled above with chat safeguard (WantTextInput check)
}
void CameraController::processMouseMotion(const SDL_MouseMotionEvent& event) {