4 Commits
Author SHA1 Message Date
popux 0740036903 Tank fix 2026-10-23 22:56:06 +02:00
popux a336ab507e Glass transparency fix 2026-10-23 20:56:05 +02:00
popux 4e8ea4ea96 Mouse sensibility tweaks 2026-10-23 20:38:59 +02:00
popux 98cd3b6b22 Gyro fix 2026-10-23 16:01:53 +02:00
4 changed files with 58 additions and 10 deletions

No files matched your search

+15 -9
View File
@@ -915,12 +915,11 @@ void inputApplyMouseRequests(void)
* Controller input is entirely independent of all of this. */
/* D594: on macOS the FOCUS_GAINED-driven click-to-lock is unreliable (AppKit
* key-window; no focus events over ssh), so start armed like PD's MLOCK_ON --
* the mouse is locked by default in-stage (see reconcileGrab()). */
#ifdef PLATFORM_MACOS
static int captureArmed = 1; /* D594: PD MLOCK_ON default (see reconcileGrab) */
#else
static int captureArmed = 0; /* user has clicked to lock (capture mode) */
#endif
* the mouse is locked by default in-stage (see reconcileGrab()). Every other
* platform starts armed too: Steam Input's gyro (Steam Deck "Gamepad with Gyro"
* template) arrives as mouse motion with no click, so click-to-lock never
* captured it. Esc still releases (inputReleaseCapture), a click re-arms. */
static int captureArmed = 1;
static int windowFocused = 1;
static int mouseAimSpeed = 16; /* aim-mode sensitivity, percent (B3: 50 -> 25 M-29 -> 16; still overshot at 25) */
static int gepdSens = 38; /* D194 Input.GepdSens: GEPD SENSITIVITY setting, range 1..500
@@ -1081,6 +1080,7 @@ struct aimSlotState {
int gepdHeldPrev; /* aim held last tick -> adopt on entry */
int aimHeldPrev; /* was s_aimHeldPrev */
int centreClearTicks; /* was s_centreClearTicks */
int mouseThisAim; /* mouse moved during this aim hold: keep its position while the stick is used too */
};
static struct aimSlotState s_aimSt[4];
#define AIMS (s_aimSt[(s_slot > 0 && s_slot < 4) ? s_slot : 0])
@@ -1760,8 +1760,8 @@ int inputInit(void)
sysLogPrintf(LOG_INFO, "input: PC bindings, crouch mode %s",
crouchMode ? "toggle" : "hold");
/* Relative mouse mode for mouse-look. Click-to-lock: we start released
* and wait for a click in the window (video.c -> inputNotifyClick). */
/* Relative mouse mode for mouse-look. Armed by default (PD MLOCK_ON, see
* captureArmed): the grab is taken once a stage runs, no click needed. */
mouseGrabbed = 0;
if (mouseEnabled) {
if (mouseRawInput) {
@@ -2523,6 +2523,7 @@ static unsigned inputComputePadSlot(int idx, signed char *stick_x, signed char *
AIMS.centreClearTicks = 2; /* see D194 centre-spring note above */
if (!aimHeld) {
AIMS.centreClearTicks = 0;
AIMS.mouseThisAim = 0;
/* GEPD adopts the game's current crosshair pos every non-aim
* frame so re-entry starts where the game left it. */
AIMS.gepdHeldPrev = 0;
@@ -2848,6 +2849,8 @@ static unsigned inputComputePadSlot(int idx, signed char *stick_x, signed char *
* driven by the port-supplied turn through the
* sub_GAME_7F067FBC hook (see Input.PdMouseAim above). */
aimGepdAccumulate(edx, dyLook);
if (fabs(edx) > 0.01 || fabs(dyLook) > 0.01)
AIMS.mouseThisAim = 1;
/* Edge-scroll belongs to the aim position, not to the
* crosshair model -- without this the camera stops
* following the crosshair at the screen edge. */
@@ -3908,7 +3911,10 @@ int portMouseAimPdActive(void)
{
/* D337: only while the mouse is the device driving aim -- otherwise the
* pad's stick turn (the N64 path, weapon damp) must reach the game. */
return pdMouseAimEnabled() && mouseGrabbed && s_aimDevMouse;
/* The mouse stays the aim position for the whole hold once it moved (gyro
* sent as mouse); the stick then offsets it (gunfire.c) instead of taking
* over. */
return pdMouseAimEnabled() && mouseGrabbed && (s_aimDevMouse || s_aimSt[0].mouseThisAim);
}
int portMouseAimPdGetTurn(f32 *tx, f32 *ty)
+16
View File
@@ -301,6 +301,12 @@ static struct Row rows[] = {
* vertical/pitch sensitivity, %); input.c already applies it. */
{ .key="Input.MouseYScale", .label="Vertical sensitivity", .kind=ROW_SLIDER, .step=10,
.uiMin=10, .uiMax=400 }, /* D506: shown as a multiplier like the horizontal row, raw 100 = 1.0x */
/* Per-case scales on top of the two rows above: turning the camera vs moving the
* crosshair while aiming. Shown as multipliers of their defaults (50 / 38). */
{ .key="Input.MouseTurnSpeed", .label="Look speed", .kind=ROW_SLIDER, .step=5,
.uiMin=5, .uiMax=250 },
{ .key="Input.AimModeSens", .label="Aim speed", .kind=ROW_SLIDER, .step=4,
.uiMin=2, .uiMax=190 },
{ .key="Input.MouseInvertY", .label="Invert look", .kind=ROW_TOGGLE, .step=1, .names=kOnOff },
{ .key="Input.MouseSmoothing", .label="Smoothing", .kind=ROW_SLIDER, .step=5, .unit="%" },
{ .key="Input.MouseRawInput", .label="Raw input", .kind=ROW_TOGGLE, .step=1, .names=kOnOff },
@@ -2082,6 +2088,8 @@ static const struct { const char *key; double def; } kResetDefaults[] = {
{ "Input.CrosshairCursor", 1 }, /* = 1 (on, D555) */
{ "Input.MouseSensitivity", 100 }, /* static int mouseSensitivity = 100 */
{ "Input.MouseYScale", 100 }, /* = 100 (native), Wave A item 6 */
{ "Input.MouseTurnSpeed", 50 }, /* static int mouseTurnSpeed = 50 */
{ "Input.AimModeSens", 38 }, /* static int gepdSens = 38 */
{ "Input.MouseInvertY", 0 }, /* = 0 */
{ "Input.AimMode", 0 }, /* = AIMMODE_N64 (0) */
{ "Input.AimRange", 0 }, /* = 0 (PC) */
@@ -2997,6 +3005,14 @@ static void valueText(int i, char *out, int n)
snprintf(out, n, "%.1fx", v / 100.0);
return;
}
if (!strcmp(r->key, "Input.MouseTurnSpeed")) { /* default 50 = 1.0x */
snprintf(out, n, "%.1fx", v / 50.0);
return;
}
if (!strcmp(r->key, "Input.AimModeSens")) { /* default 38 = 1.0x */
snprintf(out, n, "%.1fx", v / 38.0);
return;
}
if (!strcmp(r->key, "Game.ScreenShakeIntensity")) { /* D181: shown as whole % */
snprintf(out, n, "%d%%", (int)lround(v * 100.0));
return;
+18 -1
View File
@@ -5071,9 +5071,26 @@ void sub_GAME_7F067FBC(f32 turn_x, f32 turn_y)
* functions. Identity when Input.PdMouseAim is off, and the N64 build
* never sees any of it. Behavioural hook, not the ABI exception:
* Rule-2 sign-off given by the maintainer 2026-09-23. */
if (portMouseAimPdGetTurn(&turn_x, &turn_y)) {
{
f32 mouse_x, mouse_y;
if (portMouseAimPdGetTurn(&mouse_x, &mouse_y)) {
if (g_PlayerIsInTank == 1) {
/* Tank aim turns mouse motion into a stepped stick (0 or 61..70) for the
* turret, which would make the undamped crosshair jitter: mouse position only */
turn_x = mouse_x;
turn_y = mouse_y;
} else {
/* The stick still offsets the crosshair from the mouse position, so
* gyro (sent as mouse) and right-stick aiming combine, as in PD */
turn_x += mouse_x;
turn_y += mouse_y;
turn_x = (turn_x < -1.0f) ? -1.0f : ((turn_x > 1.0f) ? 1.0f : turn_x);
turn_y = (turn_y < -1.0f) ? -1.0f : ((turn_y > 1.0f) ? 1.0f : turn_y);
}
guncrossdamp = 0.01f;
}
}
#endif
caclulate_gun_crosshair_position_rotation(turn_x, turn_y, guncrossdamp, gunaimdamp);
+9
View File
@@ -5864,7 +5864,15 @@ s32 objTick(struct PropRecord *prop)
{
pad36C = (struct DoorRecord *) prop->obj;
var_s2_6 = 1;
#ifdef PORT
/* The opaque distance is the N64 s32 at 0xC4, which the struct splits into CullDist/soundType/
* fadeTime60 (Facility lab doors: 0x00000258 = 600). On PC that raw offset lands on openPosition,
* so a closed door (0.0) read 0 and its glass stayed opaque until opened. Rebuild the word. */
pad36C->calculatedopacity = glassCalculateOpacity(&obj->runtime_pos, pad36C->TintDist,
(s32)(((u32)(u16)pad36C->CullDist << 16) | ((u32)(u8)pad36C->soundType << 8) | (u8)pad36C->fadeTime60), 0.0f);
#else
pad36C->calculatedopacity = glassCalculateOpacity(&obj->runtime_pos, pad36C->TintDist, *((s32 *) (((u8 *) pad36C) + 0xC4)), 0.0f);
#endif
if (playerCount == 1)
{
if ((pad36C->calculatedopacity != 0xFF) || (pad36C->openPosition > 0.0f))
@@ -14735,3 +14743,4 @@ void drop_inventory(void)
}
}
}