diff --git a/src/k_battle.c b/src/k_battle.c index ffd370ee2..5d284bb77 100644 --- a/src/k_battle.c +++ b/src/k_battle.c @@ -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); diff --git a/src/p_local.h b/src/p_local.h index f36337615..c9e1860c1 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -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; diff --git a/src/p_user.c b/src/p_user.c index 1fdafd4aa..de8c4234e 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -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); }