Battle: cap lasers at player's last known floorz

- Do not use camera_t.floorz
- Fixes lasers bobbing up and down sometimes
This commit is contained in:
James R 2024-03-07 02:27:19 -08:00
parent e4f5e3c78e
commit a7979e973e
3 changed files with 11 additions and 2 deletions

View file

@ -654,12 +654,12 @@ static void K_SpawnOvertimeLaser(fixed_t x, fixed_t y, fixed_t scale)
if (player->mo->eflags & MFE_VERTICALFLIP)
{
zpos = cam->z + player->mo->height;
zpos = min(zpos + heightPadding, cam->ceilingz);
zpos = min(zpos + heightPadding, cam->centerceilingz);
}
else
{
zpos = cam->z;
zpos = max(zpos - heightPadding, cam->floorz);
zpos = max(zpos - heightPadding, cam->centerfloorz);
}
flip = P_MobjFlip(player->mo);

View file

@ -112,6 +112,10 @@ struct camera_t
fixed_t floorz;
fixed_t ceilingz;
// From the player
fixed_t centerfloorz;
fixed_t centerceilingz;
// For movement checking.
fixed_t radius;
fixed_t height;

View file

@ -3053,6 +3053,8 @@ void P_ResetCamera(player_t *player, camera_t *thiscam)
thiscam->x = x;
thiscam->y = y;
thiscam->z = z;
thiscam->centerfloorz = player->mo->floorz;
thiscam->centerceilingz = player->mo->ceilingz;
thiscam->angle = player->mo->angle;
thiscam->aiming = 0;
@ -3570,6 +3572,9 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
R_ResetViewInterpolation(num + 1);
}
thiscam->centerfloorz = mo->floorz;
thiscam->centerceilingz = mo->ceilingz;
return (x == thiscam->x && y == thiscam->y && z == thiscam->z && angle == thiscam->aiming);
}