From 23ce248dce0629ab19e77df20765f1bba416bc6e Mon Sep 17 00:00:00 2001 From: Maxime Morel Date: Fri, 23 Oct 2026 10:24:00 +0200 Subject: [PATCH] Look ahead --- src/game/bondmove.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/game/bondmove.c b/src/game/bondmove.c index 414e3cc1d..98b82d9fe 100644 --- a/src/game/bondmove.c +++ b/src/game/bondmove.c @@ -1833,7 +1833,12 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i } } +#ifdef PLATFORM_N64 if (controlmode == CONTROLMODE_12 || controlmode == CONTROLMODE_14 || controlmode == CONTROLMODE_PC) { +#else + // The PC controls walk with an analog stick like 1.1, so look ahead works there (see below) + if (controlmode == CONTROLMODE_12 || controlmode == CONTROLMODE_14) { +#endif movedata.disablelookahead = true; } } // end 1.x @@ -1992,6 +1997,22 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i lookahead = g_Vars.currentplayer->cachedlookahead; } +#ifndef PLATFORM_N64 + // PC controls pitch with the right stick or mouse (natural pitch), which the N64 code never + // treats as manual pitch. Do what C-up/C-down does: stop the centring until the next walk, + // or until the walk stops if already walking. + // A deliberate stick deflection only: a resting stick can drift past the small dead zone + if (controlmode == CONTROLMODE_PC + && (movedata.analogpitch > 15 || movedata.analogpitch < -15 || movedata.freelookdy != 0.0f)) { + g_Vars.currentplayer->docentreupdown = false; + g_Vars.currentplayer->automovecentre = false; + + if (movedata.canlookahead && (movedata.analogwalk > 60 || movedata.analogwalk < -60)) { + g_Vars.currentplayer->movecentrerelease = true; + } + } +#endif + if (g_Vars.currentplayer->movecentrerelease && movedata.analogwalk < 40 && movedata.analogwalk > -40) { g_Vars.currentplayer->movecentrerelease = false;