diff --git a/port/src/main.c b/port/src/main.c index a19b6a980..74a3205a6 100644 --- a/port/src/main.c +++ b/port/src/main.c @@ -75,6 +75,7 @@ static void gameLoadConfig(void) g_PlayerMouseAimSpeedY = configGetFloatClamped("Game.MouseAimSpeedY", g_PlayerMouseAimSpeedY, 0.f, 10.f); g_PlayerFovAffectsZoom = configGetIntClamped("Game.FovAffectsZoom", g_PlayerFovAffectsZoom, 0, 1); g_PlayerFovZoomMultiplier = g_PlayerFovAffectsZoom ? g_PlayerDefaultFovY / 60.0f : 1.0f; + g_PlayerClassicCrouch = configGetIntClamped("Game.ClassicCrouch", 0, 0, 1); g_ViShakeIntensityMult = configGetFloatClamped("Game.ScreenShakeIntensity", 1.f, 0.f, 100.f); const s32 center = configGetIntClamped("Game.CenterHUD", 0, 0, 1); if (center) { diff --git a/src/game/bondmove.c b/src/game/bondmove.c index 0ddfb30cd..f84be384d 100644 --- a/src/game/bondmove.c +++ b/src/game/bondmove.c @@ -1628,12 +1628,17 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i movedata.zoominfovpersec = increment; } } +#endif - // Handle crouch and uncrouch - if (allowc1buttons) { + // Handle C-button and analog crouch and uncrouch, if enabled + if (g_PlayerClassicCrouch && allowc1buttons) { for (i = 0; i < numsamples; i++) { if (!canmanualzoom && aimonhist[i]) { - if (joyGetButtonsPressedOnSample(i, contpad1, c1allowedbuttons & (U_CBUTTONS))) { + bool goUp = joyGetButtonsPressedOnSample(i, contpad1, c1allowedbuttons & (U_CBUTTONS)); +#ifndef PLATFORM_N64 + goUp = goUp || ((joyGetRStickYOnSample(i, contpad1) > 30 && joyGetRStickYOnSampleIndex(i, contpad1) <= 30)); +#endif + if (goUp) { if (movedata.crouchdown) { movedata.crouchdown--; } else { @@ -1643,7 +1648,11 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i g_Vars.currentplayer->aimtaptime = -1; } - if (joyGetButtonsPressedOnSample(i, contpad1, c1allowedbuttons & (D_CBUTTONS))) { + bool goDn = joyGetButtonsPressedOnSample(i, contpad1, c1allowedbuttons & (D_CBUTTONS)); +#ifndef PLATFORM_N64 + goDn = goDn || ((joyGetRStickYOnSample(i, contpad1) < -30 && joyGetRStickYOnSampleIndex(i, contpad1) >= -30)); +#endif + if (goDn) { if (movedata.crouchup) { movedata.crouchup--; } else { @@ -1675,7 +1684,6 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i } } } -#endif // Handle shutting eyes in multiplayer if (bmoveGetCrouchPos() == CROUCHPOS_SQUAT diff --git a/src/game/player.c b/src/game/player.c index dd7720f44..7260312dc 100644 --- a/src/game/player.c +++ b/src/game/player.c @@ -210,6 +210,7 @@ f32 g_PlayerMouseAimSpeedX = 0.75f; f32 g_PlayerMouseAimSpeedY = 0.75f; s32 g_PlayerFovAffectsZoom = 1; f32 g_PlayerFovZoomMultiplier = 1.0f; +s32 g_PlayerClassicCrouch = true; #endif /** diff --git a/src/include/data.h b/src/include/data.h index 87b0944eb..dba6ff5d0 100644 --- a/src/include/data.h +++ b/src/include/data.h @@ -542,6 +542,7 @@ extern f32 g_PlayerMouseAimSpeedX; extern f32 g_PlayerMouseAimSpeedY; extern s32 g_PlayerFovAffectsZoom; extern f32 g_PlayerFovZoomMultiplier; +extern s32 g_PlayerClassicCrouch; extern f32 g_ViShakeIntensityMult; extern u32 g_TexFilter2D; extern u32 g_HudAlignModeL;