fix loopcam jerk
This commit is contained in:
parent
0f9c385697
commit
ca8062edec
1 changed files with 51 additions and 48 deletions
99
src/p_user.c
99
src/p_user.c
|
|
@ -3151,66 +3151,69 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
|||
camdist = FixedMul(cv_cam_dist[num].value, mapobjectscale);
|
||||
camheight = FixedMul(cv_cam_height[num].value, mapobjectscale);
|
||||
|
||||
if (loop_in < loop->zoom_in_speed)
|
||||
if (leveltime > introtime)
|
||||
{
|
||||
fixed_t f = loop_out < loop->zoom_out_speed
|
||||
? (loop_out * FRACUNIT) / loop->zoom_out_speed
|
||||
: FRACUNIT - ((loop_in * FRACUNIT) / loop->zoom_in_speed);
|
||||
|
||||
camspeed -= FixedMul(f, camspeed - (FRACUNIT/10));
|
||||
camdist += FixedMul(f, loop->dist);
|
||||
}
|
||||
|
||||
if (loop_in < max(loop->pan_back, 1))
|
||||
{
|
||||
fixed_t f = (loop_in * FRACUNIT) / max(loop->pan_back, 1);
|
||||
|
||||
fixed_t dx = mo->x - thiscam->x;
|
||||
fixed_t dy = mo->y - thiscam->y;
|
||||
|
||||
angle_t th = R_PointToAngle2(0, 0, dx, dy);
|
||||
fixed_t d = AngleFixed(focusangle - th);
|
||||
|
||||
if (d > 180*FRACUNIT)
|
||||
if (loop_in < loop->zoom_in_speed)
|
||||
{
|
||||
d -= (360*FRACUNIT);
|
||||
fixed_t f = loop_out < loop->zoom_out_speed
|
||||
? (loop_out * FRACUNIT) / loop->zoom_out_speed
|
||||
: FRACUNIT - ((loop_in * FRACUNIT) / loop->zoom_in_speed);
|
||||
|
||||
camspeed -= FixedMul(f, camspeed - (FRACUNIT/10));
|
||||
camdist += FixedMul(f, loop->dist);
|
||||
}
|
||||
|
||||
focusangle = th + FixedAngle(FixedMul(f, d));
|
||||
if (loop_in < max(loop->pan_back, 1))
|
||||
{
|
||||
fixed_t f = (loop_in * FRACUNIT) / max(loop->pan_back, 1);
|
||||
|
||||
fixed_t dx = mo->x - thiscam->x;
|
||||
fixed_t dy = mo->y - thiscam->y;
|
||||
|
||||
angle_t th = R_PointToAngle2(0, 0, dx, dy);
|
||||
fixed_t d = AngleFixed(focusangle - th);
|
||||
|
||||
if (d > 180*FRACUNIT)
|
||||
{
|
||||
d -= (360*FRACUNIT);
|
||||
}
|
||||
|
||||
focusangle = th + FixedAngle(FixedMul(f, d));
|
||||
|
||||
if (loop_in == 0)
|
||||
{
|
||||
focusaiming = R_PointToAngle2(0, thiscam->z, FixedHypot(dx, dy), mo->z);
|
||||
}
|
||||
}
|
||||
|
||||
if (loop_in == 0)
|
||||
{
|
||||
focusaiming = R_PointToAngle2(0, thiscam->z, FixedHypot(dx, dy), mo->z);
|
||||
}
|
||||
}
|
||||
tic_t accel = max(loop->pan_accel, 1);
|
||||
fixed_t f = (min(loop_out, accel) * FRACUNIT) / accel;
|
||||
|
||||
if (loop_in == 0)
|
||||
{
|
||||
tic_t accel = max(loop->pan_accel, 1);
|
||||
fixed_t f = (min(loop_out, accel) * FRACUNIT) / accel;
|
||||
INT32 turn = AngleDeltaSigned(focusangle, player->loop.yaw - loop->pan);
|
||||
INT32 turnspeed = FixedAngle(FixedMul(f, loop->pan_speed));
|
||||
|
||||
INT32 turn = AngleDeltaSigned(focusangle, player->loop.yaw - loop->pan);
|
||||
INT32 turnspeed = FixedAngle(FixedMul(f, loop->pan_speed));
|
||||
|
||||
if (turn > turnspeed)
|
||||
{
|
||||
// TODO: this code let the panning angle flip
|
||||
// depending on your camera angle when entering
|
||||
// the loop.
|
||||
// It caused just about every loop to look weird
|
||||
// sometimes, since the camera could move
|
||||
// differently than configured.
|
||||
// I don't know if this behavior should ever come
|
||||
// back, but in case it should, I'm leaving this
|
||||
// comment here.
|
||||
#if 0
|
||||
if (turn < ANGLE_90)
|
||||
if (turn > turnspeed)
|
||||
{
|
||||
turnspeed = -(turnspeed);
|
||||
}
|
||||
// TODO: this code let the panning angle flip
|
||||
// depending on your camera angle when entering
|
||||
// the loop.
|
||||
// It caused just about every loop to look weird
|
||||
// sometimes, since the camera could move
|
||||
// differently than configured.
|
||||
// I don't know if this behavior should ever come
|
||||
// back, but in case it should, I'm leaving this
|
||||
// comment here.
|
||||
#if 0
|
||||
if (turn < ANGLE_90)
|
||||
{
|
||||
turnspeed = -(turnspeed);
|
||||
}
|
||||
#endif
|
||||
|
||||
focusangle += turnspeed;
|
||||
focusangle += turnspeed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue