M-25: [Input] ge007.ini knobs — mouse Y scale/smoothing, pad deadzone/trigger/invert-Y

This commit is contained in:
James Dansereau committed 2026-08-30 12:35:17 -04:00
1 parent bc97cdab0a
commit 39dded2a17
2 files changed
+108 -12

No files matched your search

+63 -1
View File
@@ -10,7 +10,8 @@ pre-M-25 behavior — a fresh or partial `ge007.ini` changes nothing.
| Commit | Title |
|---|---|
| `9ebed821` | `[Video]` ge007.ini knobs + config auto-migration |
| _(this)_ | `tools_pc/playtest.sh` — name lookup, `--list`, auto-addr2line |
| `5a7a1035` | `tools_pc/playtest.sh` — name lookup, `--list`, auto-addr2line |
| _(this)_ | `[Input]` knobs — mouse Y scale / smoothing, pad deadzone / trigger / invert-Y |
---
@@ -116,6 +117,67 @@ Verified: `--list` output correct; name + number resolution; a real
---
## 3. `[Input]` knobs (`port/src/input.c`)
### Rationale
Feel tuning that was hardcoded. Every default is the exact prior constant,
so a fresh/partial ini changes nothing (verified against a from-baseline
build — see below).
| Key | Default | Effect |
|---|---|---|
| `Input.MouseYScale` | 100 | extra vertical (pitch) sensitivity multiplier, % — applied to the mouse dy before aim/hipfire mapping |
| `Input.MouseSmoothing` | 0 | 0 = raw deltas (today); 1..90 = exponential low-pass, value = % blend of the previous poll |
| `Input.PadDeadzone` | 7000 | left-stick deadzone, raw 0..32767 (was `STICK_DEADZONE`) |
| `Input.PadTriggerPct` | 23 | trigger press point, % of travel (≈ the old `30*256` threshold: 23 × 327 ≈ 7521 vs 7680) |
| `Input.PadLookInvertY` | 0 | 1 = invert right-stick (look) Y |
`MouseYScale` / `MouseSmoothing` feed through the same mode-aware
mouse→pad path as the M-24 rework (aim-mode band vs hipfire digital pitch);
smoothing state is a pair of static doubles, reset implicitly when the
deltas go to zero. `PadDeadzone` flows through `scaleAxis()` (clamped
0..30000 so the divisor can't go non-positive). `PadTriggerPct`
recomputes the threshold from a percentage; `PadLookInvertY` negates `ry`
before the C-button mapping.
### Review risk
Low. Same class as §1 — read an int, feed an existing code path.
`scaleAxis` divisor is guarded. Worst case is bad feel, all runtime-tunable.
Cannot change the `OSContPad` contract.
### Verification
- Build green; the two `input.c` warnings (`fabs` implicit-decl, `getenv`)
are **pre-existing** — confirmed identical on a stashed baseline build,
not introduced here.
- `-level_09`: crash-free to frame 620, **91.6% coverage (unregressed)**.
- `-level_20` (Silo): crash-free; frame capture stops at ~320 —
**confirmed identical on the pre-change baseline build** (the known Silo
camera-descent freeze the user reported this session, not a regression).
- New keys land in `[Input]` on next launch via the §1 migration path;
existing values (`MouseAimSpeed = 77`) preserved.
### What to check by playing
1. `MouseYScale = 150` → faster vertical look, horizontal unchanged.
2. `MouseSmoothing = 60` → visibly smoothed / slightly laggy aim; `0` crisp.
3. `PadDeadzone = 3000` → stick responds to smaller nudges; `12000` → larger
dead center. `PadLookInvertY = 1` → inverted pad look. `PadTriggerPct`
low → hair trigger.
---
## Known pre-existing bugs noted this session (not addressed — out of scope)
- **Silo (`-level_20`) early freeze** — ~3 s in, when the camera pans from
the silo down to the player view, the sim wedges (no crash; frame capture
freezes ~frame 320). Reproduces on a clean pre-M-25 build. User-reported
M-25. Belongs with the in-level playtest / camera-transition work.
---
## Still TODO (carried from M-24)
Key rebinding, in-render on-screen FPS/pos overlay, in-game options menu,
+45 -11
View File
@@ -127,6 +127,16 @@ static int mouseGrabbed = 1; /* released while the window is unfocused */
static int mouseAimSpeed = 50; /* aim-mode sensitivity, percent */
static int mouseTurnSpeed = 100; /* hipfire yaw sensitivity, percent */
static int mouseInvertY = 0; /* 1 = mouse-down looks up */
static int mouseYScale = 100; /* extra vertical (pitch) sensitivity, % */
static int mouseSmoothing = 0; /* 0 = raw; 1..90 = low-pass strength (%) */
/* Gamepad tuning -- defaults reproduce the old hardcoded constants exactly. */
static int padDeadzone = STICK_DEADZONE; /* left-stick deadzone, raw 0..32767 */
static int padTriggerPct = 23; /* trigger press point, % of travel (~30*256) */
static int padLookInvertY = 0; /* 1 = invert right-stick (look) Y */
/* Smoothed mouse delta carried between polls when mouseSmoothing > 0. */
static double mouseSmDX = 0.0, mouseSmDY = 0.0;
/* Raw relative-mouse delta accumulated since the last inputComputePad(0).
* NOT a persistent aim accumulator: mouse-look is a displacement device and
@@ -236,11 +246,14 @@ void inputUpdate(void)
static int scaleAxis(int v)
{
if (v > -STICK_DEADZONE && v < STICK_DEADZONE) {
int dz = padDeadzone;
if (dz < 0) dz = 0;
if (dz > 30000) dz = 30000;
if (v > -dz && v < dz) {
return 0;
}
if (v < 0) v += STICK_DEADZONE; else v -= STICK_DEADZONE;
int out = (int)((long)v * STICK_MAX / (32767 - STICK_DEADZONE));
if (v < 0) v += dz; else v -= dz;
int out = (int)((long)v * STICK_MAX / (32767 - dz));
if (out > STICK_MAX) out = STICK_MAX;
if (out < -STICK_MAX) out = -STICK_MAX;
return out;
@@ -308,21 +321,35 @@ unsigned inputComputePad(int idx, signed char *stick_x, signed char *stick_y)
* aim-mode down = +stick_y. MouseInvertY flips both. */
if (mouseEnabled) {
double invert = mouseInvertY ? -1.0 : 1.0;
double dyLook = mouseDY * invert; /* >0 => look down */
/* Optional exponential low-pass (mouseSmoothing = blend % of the
* previous poll). Off (0) => edx/edy are the raw deltas. */
double edx = mouseDX, edy = mouseDY;
if (mouseSmoothing > 0) {
double a = mouseSmoothing / 100.0;
if (a > 0.90) a = 0.90;
mouseSmDX = mouseSmDX * a + edx * (1.0 - a);
mouseSmDY = mouseSmDY * a + edy * (1.0 - a);
edx = mouseSmDX;
edy = mouseSmDY;
}
edy *= mouseYScale / 100.0;
double dyLook = edy * invert; /* >0 => look down */
if (aimHeld) {
double gx = fabs(mouseDX) * (mouseAimSpeed / 100.0) * AIM_GAIN;
double gy = fabs(dyLook) * (mouseAimSpeed / 100.0) * AIM_GAIN;
if (fabs(mouseDX) >= AIM_MOVE_THRESH) {
double gx = fabs(edx) * (mouseAimSpeed / 100.0) * AIM_GAIN;
double gy = fabs(dyLook) * (mouseAimSpeed / 100.0) * AIM_GAIN;
if (fabs(edx) >= AIM_MOVE_THRESH) {
int m = 61 + (int)gx; if (m > 60 + AIM_BAND) m = 60 + AIM_BAND;
sx += (mouseDX > 0) ? m : -m;
sx += (edx > 0) ? m : -m;
}
if (fabs(dyLook) >= AIM_MOVE_THRESH) {
int m = 61 + (int)gy; if (m > 60 + AIM_BAND) m = 60 + AIM_BAND;
sy += (dyLook > 0) ? m : -m; /* +stick_y = look down */
}
} else {
sx += (int)(mouseDX * (mouseTurnSpeed / 100.0) * MOUSE_TURN_GAIN);
sx += (int)(edx * (mouseTurnSpeed / 100.0) * MOUSE_TURN_GAIN);
if (dyLook >= MOUSE_PITCH_THRESH) button |= GE_CONT_E; /* C-up = look down */
else if (dyLook <= -MOUSE_PITCH_THRESH) button |= GE_CONT_D; /* C-down = look up */
}
@@ -345,14 +372,16 @@ unsigned inputComputePad(int idx, signed char *stick_x, signed char *stick_y)
if (px) sx = px;
if (py) sy = py;
if (padLookInvertY) ry = -ry;
if (rx > RSTICK_THRESHOLD) button |= GE_CONT_F;
if (rx < -RSTICK_THRESHOLD) button |= GE_CONT_C;
if (ry > RSTICK_THRESHOLD) button |= GE_CONT_D;
if (ry < -RSTICK_THRESHOLD) button |= GE_CONT_E;
if (SDL_GameControllerGetAxis(pad, SDL_CONTROLLER_AXIS_TRIGGERRIGHT) > TRIG_THRESHOLD)
int trigPt = padTriggerPct * 327; /* % of the 0..32767 trigger travel */
if (SDL_GameControllerGetAxis(pad, SDL_CONTROLLER_AXIS_TRIGGERRIGHT) > trigPt)
button |= GE_CONT_G;
if (SDL_GameControllerGetAxis(pad, SDL_CONTROLLER_AXIS_TRIGGERLEFT) > TRIG_THRESHOLD)
if (SDL_GameControllerGetAxis(pad, SDL_CONTROLLER_AXIS_TRIGGERLEFT) > trigPt)
button |= GE_CONT_R;
if (SDL_GameControllerGetButton(pad, SDL_CONTROLLER_BUTTON_A) ||
@@ -446,4 +475,9 @@ PD_CONSTRUCTOR static void inputConfigInit(void)
configRegisterInt("Input.MouseAimSpeed", &mouseAimSpeed, 1, 500);
configRegisterInt("Input.MouseTurnSpeed", &mouseTurnSpeed, 1, 500);
configRegisterInt("Input.MouseInvertY", &mouseInvertY, 0, 1);
configRegisterInt("Input.MouseYScale", &mouseYScale, 1, 500);
configRegisterInt("Input.MouseSmoothing", &mouseSmoothing, 0, 90);
configRegisterInt("Input.PadDeadzone", &padDeadzone, 0, 30000);
configRegisterInt("Input.PadTriggerPct", &padTriggerPct, 1, 99);
configRegisterInt("Input.PadLookInvertY", &padLookInvertY, 0, 1);
}