smoother slope rotation for players #55

Merged
alufolie91 merged 2 commits from rotsnap into Saturn 2023-09-08 10:51:55 +02:00
2 changed files with 10 additions and 1 deletions

No files matched your search

+1
View File
@@ -371,6 +371,7 @@ typedef struct player_s
angle_t viewrollangle;
angle_t tilt;
angle_t tilt_sprite;
// Mouse aiming, where the guy is looking at!
// It is updated with cmd->aiming.
+9 -1
View File
@@ -3132,6 +3132,7 @@ static angle_t K_GetSlopeRollAngle(player_t *p, boolean dontflip, boolean useRes
angle_t zangle = 0;
angle_t xydirection = 0;
angle_t an;
angle_t final_slope;
INT32 pNum = K_FindPlayerNum(p);
I_Assert(p != NULL);
@@ -3171,7 +3172,14 @@ static angle_t K_GetSlopeRollAngle(player_t *p, boolean dontflip, boolean useRes
zangle = InvAngle(zangle);
an = (lookAngle - xydirection);
return FixedMul(zangle, FINESINE(an>>ANGLETOFINESHIFT));
final_slope = -(FixedMul(FINESINE(an>>ANGLETOFINESHIFT), zangle));
an = (INT32)(final_slope - p->tilt_sprite) / 3; // instead of just a direct snap
if (an)
p->tilt_sprite += an;
else
p->tilt_sprite = final_slope;
return -p->tilt_sprite;
}
static void K_RollPlayerBySlopes(player_t *p, boolean usedistance)