Skip to content

Commit

Permalink
port: allow user to go back to the original crouch controls
Browse files Browse the repository at this point in the history
set Game.ClassicCrouch=1
  • Loading branch information
fgsfdsfgs committed Oct 22, 2023
1 parent 8347900 commit 4c10760
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
1 change: 1 addition & 0 deletions port/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
18 changes: 13 additions & 5 deletions src/game/bondmove.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down Expand Up @@ -1675,7 +1684,6 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
}
}
}
#endif

// Handle shutting eyes in multiplayer
if (bmoveGetCrouchPos() == CROUCHPOS_SQUAT
Expand Down
1 change: 1 addition & 0 deletions src/game/player.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

/**
Expand Down
1 change: 1 addition & 0 deletions src/include/data.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 4c10760

Please sign in to comment.