Bring back cv_quaketilt, add cv_tiltsmoothing to adjust the smoothening

This commit is contained in:
James R authored and Galactice committed 2022-11-08 10:42:24 -05:00
1 parent 8479a7189c
commit 43678ddcfe
3 files changed
+126

No files matched your search

+7
View File
@@ -137,6 +137,13 @@ extern consvar_t cv_cam3_speed, cv_cam3_rotate, cv_cam3_rotspeed;
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_tilting;
extern consvar_t cv_quaketilt;
extern consvar_t cv_tiltsmoothing;
extern consvar_t cv_actionmovie;
extern consvar_t cv_windowquake;
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;
+113
View File
@@ -7116,6 +7116,13 @@ consvar_t cv_cam4_speed = {"cam4_speed", "0.4", CV_FLOAT|CV_SAVE, CV_CamSpeed, N
consvar_t cv_cam4_rotate = {"cam4_rotate", "0", CV_CALL|CV_NOINIT, CV_CamRotate, CV_CamRotate4_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam4_rotspeed = {"cam4_rotspeed", "10", CV_SAVE, rotation_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_tilting = {"tilting", "On", 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};
consvar_t cv_tiltsmoothing = {"tiltsmoothing", "32", CV_SAVE, CV_Natural, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_actionmovie = {"actionmovie", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_windowquake = {"windowquake", "Off", CV_SAVE, CV_OnOff, 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;
@@ -8230,6 +8237,112 @@ void P_DoTimeOver(player_t *player)
exitcountdown = 5*TICRATE;
}
/* 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);
INT32 delta = (INT32)( player->mo->angle - moma );
fixed_t speed;
boolean sliptiding =
(
player->kartstuff[k_aizdriftstrat] != 0 &&
player->kartstuff[k_drift] == 0
);
if (delta == (INT32)ANGLE_180)/* FUCK YOU HAVE A HACK */
{
return 0;
}
// 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))
{
if (sliptiding)
{
tilt = ANGLE_45;
lowb = 5*FRACUNIT;
}
else
{
tilt = ANGLE_11hh/2;
lowb = 15*FRACUNIT;
}
}
else
{
tilt = ANGLE_22h;
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)
{
angle_t slope;
angle_t delta;
if (player->mo->standingslope)
{
slope = player->mo->standingslope->zangle;
}
else
{
slope = 0;
}
if (abs((INT32)slope) > ANGLE_11hh)
{
delta = ( player->mo->angle - player->mo->standingslope->xydirection );
slope = -(FixedMul(FINESINE (delta>>ANGLETOFINESHIFT), slope));
}
else
{
slope = 0;
}
if (cv_quaketilt.value)
{
slope -= Quaketilt(player);
}
delta = (INT32)( slope - player->tilt )/ cv_tiltsmoothing.value;
if (delta)
player->tilt += delta;
else
player->tilt = slope;
if (cv_tilting.value)
{
player->viewrollangle = player->tilt;
if (cv_actionmovie.value)
{
player->viewrollangle += quake.roll;
}
}
else
{
player->viewrollangle = 0;
}
}
//
// P_PlayerThink
//
+6
View File
@@ -1815,6 +1815,12 @@ void R_RegisterEngineStuff(void)
CV_RegisterVar(&cv_cam4_rotate);
CV_RegisterVar(&cv_cam4_rotspeed);
CV_RegisterVar(&cv_tilting);
CV_RegisterVar(&cv_quaketilt);
CV_RegisterVar(&cv_tiltsmoothing);
CV_RegisterVar(&cv_actionmovie);
CV_RegisterVar(&cv_windowquake);
CV_RegisterVar(&cv_showhud);
CV_RegisterVar(&cv_translucenthud);