Add VR locomotion: move/turn with thumbsticks while the menu is open
build / build (push) Successful in 2m25s

- Left thumbstick snap-turns, right thumbstick smooth-moves, letting the
  player line themselves up with the fixed game quad ("virtual screen")
  without needing physical room-scale space to do it in. Implemented via
  a second OpenXR reference space (a "play space") derived from the real
  LOCAL space by the inverse of the player's transform, so every existing
  quad/hit-testing/rendering call site just needed g_local_space swapped
  for it - no manual coordinate-transform math required elsewhere
- Generalized the ray/quad hit-testing in xr_input.c to a proper
  oriented-plane intersection (needed once quads can rotate); verified it
  degenerates to the old axis-aligned formula when unrotated, so the
  keyboard and non-recentered menu are unaffected
- The menu launcher now re-centers in front of the player, correctly
  oriented to face them, each time it's freshly reopened
- "Reset Position" (Main Menu tab) recenters using the player's current
  real head pose - not a plain reset-to-origin, which only undid
  thumbstick movement and ignored physical drift since the session
  started. The same recenter runs once automatically at startup too, as a
  fallback for when there's no complete saved position to use instead
- Position/orientation persists in questshock.config.json's new
  player_position group (independent of savegames), including new
  numeric-value support in the config file's hand-rolled JSON parser
  (previously string-enums only)
This commit is contained in:
ml
2026-09-05 15:47:54 +02:00
parent c0619a55ab
commit 360a1f7e3d
12 changed files with 812 additions and 46 deletions
+16 -6
View File
@@ -56,13 +56,23 @@ void qs_config_request_set_resolution(int resolution_index);
// menu applies a language change (see qs_config.c's qs_apply_language()).
void qs_config_request_set_language(int language_index);
// Returns true and handles the event if it's one of the five custom events
// Same cross-thread-dispatch reasoning as the three above - called from the
// Main Menu tab's "Reset Position" button. A pure, live "return to a sane
// view of the game quad" action (see xr_input.h's own
// xr_input_recenter_player_to_screen(), which this dispatches to) -
// unrelated to questshock.config.json despite living in this file for the
// cross-thread dispatch machinery: it never reads or writes the config
// file, and isn't a "reset to (0,0,0)" - it recenters based on the
// player's current real head pose instead.
void qs_config_request_reset_position(void);
// Returns true and handles the event if it's one of the six custom events
// qs_config_request_save()/_load()/_set_renderer()/_set_resolution()/
// _set_language() enqueue - called from pump_events() (sdl_events.c, see
// android/engine-patches/21-android-config.patch) on the engine's own
// thread, once per polled event, before its normal switch on well-known
// SDL_* event types. Returns false (no-op) for any other event type,
// including before the five custom types have even been registered.
// _set_language()/_reset_position() enqueue - called from pump_events()
// (sdl_events.c, see android/engine-patches/21-android-config.patch) on the
// engine's own thread, once per polled event, before its normal switch on
// well-known SDL_* event types. Returns false (no-op) for any other event
// type, including before the six custom types have even been registered.
bool qs_config_handle_event(const SDL_Event *event);
// Read-only queries for the Video Options tab's own selection highlight