diff --git a/src/p_local.h b/src/p_local.h index d4ee7643f..56df91585 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -137,6 +137,7 @@ extern consvar_t cv_cam4_dist, cv_cam4_still, cv_cam4_height; extern consvar_t cv_cam4_speed, cv_cam4_rotate, cv_cam4_rotspeed; extern consvar_t cv_inverseslope; +extern consvar_t cv_quaketilt; extern fixed_t t_cam_dist, t_cam_height, t_cam_rotate; extern fixed_t t_cam2_dist, t_cam2_height, t_cam2_rotate; diff --git a/src/p_user.c b/src/p_user.c index 4a9d4c745..4c5a85eda 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -7109,6 +7109,7 @@ consvar_t cv_cam4_rotate = {"cam4_rotate", "0", CV_CALL|CV_NOINIT, CV_CamRotate, consvar_t cv_cam4_rotspeed = {"cam4_rotspeed", "10", CV_SAVE, rotation_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; 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 = -42; fixed_t t_cam_height = -42; @@ -8221,6 +8222,38 @@ void P_DoTimeOver(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) { @@ -8238,6 +8271,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 c9722d581..ee071c06f 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -1844,6 +1844,7 @@ void R_RegisterEngineStuff(void) CV_RegisterVar(&cv_cam4_rotspeed); CV_RegisterVar(&cv_inverseslope); + CV_RegisterVar(&cv_quaketilt); CV_RegisterVar(&cv_showhud); CV_RegisterVar(&cv_translucenthud);