diff --git a/docs/controls.md b/docs/controls.md index 0aa02978..0b628186 100644 --- a/docs/controls.md +++ b/docs/controls.md @@ -131,9 +131,10 @@ bind_Y = pad:north, key:mouse_l ## Free camera -On game 1.4.3, ZL+ZR+L3 together (LT+RT+L3 on an Xbox pad) or F6 detach the view from Link; the same combo or key brings -it back (`freecam_pad` and `freecam_key` in `totk.ini` and on the Controls tab pick others, `none` none). The world goes -on, but the game gets no input while the free camera is on, so Link stands where he was. +On game 1.4.3, a chosen gamepad combo or a key activates or deactivates the free camera. Neither is set by default: pick +them with `freecam_pad` and `freecam_key` in `totk.ini` or on the Controls tab (for example ZL+ZR+L3, LT+RT+L3 on an +Xbox pad, and F6; `none` turns one off). The world goes on, but the game gets no input while the free camera is on, so +Link stands where he was. | Gamepad | Keyboard and mouse (default bindings) | Free camera | |---|---|---| diff --git a/runtime/cfg.c b/runtime/cfg.c index f6a3caa5..6a5bcec1 100644 --- a/runtime/cfg.c +++ b/runtime/cfg.c @@ -189,7 +189,7 @@ static const CfgMeta metas[] = { {"QUICKSAVE", "0", "0|1", LIVE}, // quicksave.c: one key saves (an autosave), another loads it {"QUICKSAVE_KEY", "f6", NULL, LIVE}, {"QUICKLOAD_KEY", "f7", NULL, LIVE}, // Half-Life's keys; a key name or none {"WALK_KEY", "none", NULL, LIVE}, {"WALK_SCALE", "0.51", "0.2..0.9", LIVE}, - {"FREECAM_PAD", "zl+zr+lstick", NULL, LIVE}, {"FREECAM_KEY", "f6", NULL, LIVE}, + {"FREECAM_PAD", "none", NULL, LIVE}, {"FREECAM_KEY", "none", NULL, LIVE}, // Gameplay Tweaks {"GAMEPLAY_TWEAKS_ENABLED", "0", "0|1", LIVE}, {"GAMEPLAY_ULTRAHAND_ROTATE", "1", "0|1", LIVE}, {"GAMEPLAY_ULTRAHAND_C_AXIS", "1", "0|1", LIVE}, diff --git a/runtime/freecam.c b/runtime/freecam.c index 60759e8f..9eb71bd3 100644 --- a/runtime/freecam.c +++ b/runtime/freecam.c @@ -21,11 +21,12 @@ // the anchor is driven. When no driven component has been updated for LOST_NS (a load replaced them) the next one // away from the default anchors again; the free camera keeps its own position. // -// Input (runtime/input.c freecam_gate): TOTK_FREECAM_PAD (ZL+ZR+L3 by default) or TOTK_FREECAM_KEY (F6) switches -// it. While it is on the game gets no input; the left stick flies along the view and to the side, ZR and ZL straight -// up and down, the right stick and the mouse turn, and each press of L or R halves or doubles the speed. Keys work -// through their bindings: the keys' sticks, and the keys bound to ZL, ZR, L and R. Every driven component steps the -// flight by the wall-clock time since the last step, so the speed is the same at any frame rate and game speed. +// Input (runtime/input.c freecam_gate): TOTK_FREECAM_PAD or TOTK_FREECAM_KEY switches it (both none by default, so the +// player opts in). While it is on the game gets no input; the left stick flies along the view and to the side, ZR and +// ZL straight up and down, the right stick and the mouse turn, and each press of L or R halves or doubles the speed. +// Keys work through their bindings: the keys' sticks, and the keys bound to ZL, ZR, L and R. Every driven component +// steps the flight by the wall-clock time since the last step, so the speed is the same at any frame rate and game +// speed. #include #include #include diff --git a/runtime/input.c b/runtime/input.c index e12fce7f..aef76cd6 100644 --- a/runtime/input.c +++ b/runtime/input.c @@ -815,8 +815,8 @@ uint32_t input_pad_combo(const char *env, const char *s) { return mask; } -// TOTK_FREECAM_PAD (live): the combo that switches the free camera (freecam.c); zl+zr+lstick (LT+RT+L3) when unset, -// none for no combo. Under lock. +// TOTK_FREECAM_PAD (live): the combo that switches the free camera (freecam.c), for example zl+zr+lstick (LT+RT+L3); +// none, the default (the settings table), for no combo. Under lock. static uint32_t freecam_pad_mask(void) { static unsigned seen; static int read; @@ -824,13 +824,12 @@ static uint32_t freecam_pad_mask(void) { unsigned v = cfg_version(); if (read && v == seen) return mask; read = 1, seen = v; - const char *s = cfg_get("TOTK_FREECAM_PAD"); - if (!s || !*s) s = "zl+zr+lstick"; - mask = strcasecmp(s, "none") ? input_pad_combo("TOTK_FREECAM_PAD", s) : 0; + const char *s = cfg_value("TOTK_FREECAM_PAD"); + mask = *s && strcasecmp(s, "none") ? input_pad_combo("TOTK_FREECAM_PAD", s) : 0; return mask; } -// TOTK_FREECAM_KEY (live): the key that switches the free camera, f6 by default (the settings table), none for no key. +// TOTK_FREECAM_KEY (live): the key that switches the free camera; none, the default (the settings table), for no key. // Under lock. static int freecam_key(void) { static unsigned seen; diff --git a/runtime/ui/menu.cpp b/runtime/ui/menu.cpp index b8eb708a..5b7a9812 100644 --- a/runtime/ui/menu.cpp +++ b/runtime/ui/menu.cpp @@ -962,7 +962,7 @@ static void rows_freecam(void) { names[N - 1] = menu_text(UI_MENU_OFF); if (!freecam_available()) opt_disable_next(UI_MENU_FREECAM_PAD_V143); opt_choice_list("TOTK_FREECAM_PAD", UI_MENU_FREECAM_PAD, combos, names, N, UI_MENU_FREECAM_PAD_DESC); - // The free camera key: keys no default binding uses ("none" rather than an empty value turns it off: unset is f6) + // The free camera key: keys no default binding uses (none, the default, turns it off) static const char *const keys[] = {"none", "f2", "f3", "f4", "f5", "f6", "f7", "f9"}; const char *key_names[] = {menu_text(UI_MENU_OFF), "F2", "F3", "F4", "F5", "F6", "F7", "F9"}; if (!freecam_available()) opt_disable_next(UI_MENU_FREECAM_PAD_V143); diff --git a/totk.ini.example b/totk.ini.example index 4302ed6f..cbba2bea 100644 --- a/totk.ini.example +++ b/totk.ini.example @@ -483,10 +483,11 @@ # Free camera (game 1.4.3): the gamepad combo that switches it, buttons by position joined with +, the pad: names of the # bind_ lines. While it is on the game gets no input and the view flies: the left stick along the view and sideways, # the triggers straight up and down, the right stick turns; each press of L halves the speed, of R doubles it -# (docs/controls.md, "Free camera"). none turns the combo off. Default: zl+zr+lstick (LT+RT+L3 on an Xbox pad). +# (docs/controls.md, "Free camera"). none turns the combo off. Default: none; # freecam_pad = zl+zr+lstick # A key that does the same, by its name in the bind_ lines; on the keyboard the keys bound to the sticks fly and turn, # the keys of ZR and ZL go up and down, those of R and L change the speed, and the mouse turns. none turns it off. +# Default: none. # freecam_key = f6 # Write the input of this run to a file that replays as a script (docs/controls.md, "Scripted input"). Default: off. # input_record = input.txt