From a8fe25dd41ae65b494913cd2570e1630bd285892 Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 25 Jan 2020 23:36:24 -0800 Subject: [PATCH] QUAAAAAAAAKE --- src/p_local.h | 1 + src/p_user.c | 36 ++++++++++++++++++++++++++++++++++++ src/r_main.c | 1 + 3 files changed, 38 insertions(+) diff --git a/src/p_local.h b/src/p_local.h index 0300cffa4..4c657eca6 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -134,6 +134,7 @@ extern consvar_t cv_cam_speed[MAXSPLITSCREENPLAYERS], cv_cam_rotate[MAXSPLITSCRE extern fixed_t t_cam_dist[MAXSPLITSCREENPLAYERS], t_cam_height[MAXSPLITSCREENPLAYERS], t_cam_rotate[MAXSPLITSCREENPLAYERS]; extern consvar_t cv_inverseslope; +extern consvar_t cv_quaketilt; void P_AddPlayerScore(player_t *player, UINT32 amount); void P_ResetCamera(player_t *player, camera_t *thiscam); diff --git a/src/p_user.c b/src/p_user.c index 2dc6b60b7..0c0c0d67e 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2726,6 +2726,7 @@ consvar_t cv_cam_rotate[MAXSPLITSCREENPLAYERS] = { }; consvar_t cv_inverseslope = {"inverseslope", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_quaketilt = {"quaketilt", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; fixed_t t_cam_dist[MAXSPLITSCREENPLAYERS] = {-42,-42,-42,-42}; fixed_t t_cam_height[MAXSPLITSCREENPLAYERS] = {-42,-42,-42,-42}; @@ -4164,6 +4165,38 @@ static void P_HandleFollower(player_t *player) /* gaysed script from me, based on Golden's sprite slope roll */ +// holy SHIT +static INT32 +Quaketilt (player_t *player) +{ + angle_t tilt; + fixed_t lowb; // this threshold for speed + angle_t moma = R_PointToAngle2(0, 0, player->mo->momx, player->mo->momy); + angle_t delta = (INT32)( player->mo->angle - moma ); + fixed_t speed; + // Hi! I'm "not a math guy"! + if (abs(delta) > ANGLE_90) + delta = (INT32)(( moma + ANGLE_180 ) - player->mo->angle ); + if (P_IsObjectOnGround(player->mo)) + { + tilt = ANGLE_11hh; + lowb = 15*FRACUNIT; + } + else + { + tilt = ANGLE_45; + lowb = 10*FRACUNIT; + } + moma = FixedMul(FixedDiv(delta, ANGLE_90), tilt); + speed = abs( player->mo->momx + player->mo->momy ); + if (speed < lowb) + { + // ease out tilt as we slow... + moma = FixedMul(moma, FixedDiv(speed, lowb)); + } + return moma; +} + static void DoABarrelRoll (player_t *player) { @@ -4181,6 +4214,9 @@ DoABarrelRoll (player_t *player) else slope = 0; + if (cv_quaketilt.value) + slope += Quaketilt(player); + delta = (INT32)( slope - player->viewrollangle )/ 16; if (delta) diff --git a/src/r_main.c b/src/r_main.c index 7f7000588..d3762de3c 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -1706,6 +1706,7 @@ void R_RegisterEngineStuff(void) } CV_RegisterVar(&cv_inverseslope); + CV_RegisterVar(&cv_quaketilt); CV_RegisterVar(&cv_showhud); CV_RegisterVar(&cv_translucenthud);