From 036df817f1c9cf061dfa6addf968f6ab3f8788bb Mon Sep 17 00:00:00 2001 From: Alug Date: Sat, 31 Aug 2024 18:45:29 +0200 Subject: [PATCH] give camera lookback a toggle + extra option --- src/p_local.h | 2 ++ src/p_user.c | 10 +++++++--- src/r_main.c | 2 ++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/p_local.h b/src/p_local.h index 725aa20d1..4eb927a58 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -144,6 +144,8 @@ extern consvar_t cv_tiltsmoothing; extern consvar_t cv_actionmovie; +extern consvar_t cv_lookbackmom; + extern fixed_t t_cam_dist, t_cam_height, t_cam_rotate; extern fixed_t t_cam2_dist, t_cam2_height, t_cam2_rotate; extern fixed_t t_cam3_dist, t_cam3_height, t_cam3_rotate; diff --git a/src/p_user.c b/src/p_user.c index 14d60ddbd..f9d909cd5 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -3073,6 +3073,9 @@ consvar_t cv_tiltsmoothing = {"tiltsmoothing", "32", CV_SAVE, CV_Natural, NULL, consvar_t cv_actionmovie = {"actionmovie", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +static CV_PossibleValue_t lookbackmom_cons_t[] = {{0, "Off"}, {1, "On"}, {2, "Extra Momentum"}, {0, NULL}}; +consvar_t cv_lookbackmom = {"cameralookbackmom", "Off", CV_SAVE, lookbackmom_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; + fixed_t t_cam_dist = -42; fixed_t t_cam_height = -42; fixed_t t_cam_rotate = -42; @@ -3891,10 +3894,11 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall // when looking back, camera's momentum // should inherit the momentum of the player - if (lookback && lookbackdelay[num]) + // if value is 2, add extra + if (cv_lookbackmom.value && lookback && lookbackdelay[num]) { - thiscam->momx += mo->momx; - thiscam->momy += mo->momy; + thiscam->momx += cv_lookbackmom.value*mo->momx; + thiscam->momy += cv_lookbackmom.value*mo->momy; } thiscam->momz = FixedMul(z - thiscam->z, camspeed/2); diff --git a/src/r_main.c b/src/r_main.c index e6247ceae..abf2d8310 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -1959,6 +1959,8 @@ void R_RegisterEngineStuff(void) CV_RegisterVar(&cv_tiltsmoothing); CV_RegisterVar(&cv_actionmovie); + CV_RegisterVar(&cv_lookbackmom); + CV_RegisterVar(&cv_driftsparkpulse); CV_RegisterVar(&cv_gravstretch); CV_RegisterVar(&cv_sloperoll);