From 209c545743376702e763cc385044f8a17ec51d21 Mon Sep 17 00:00:00 2001 From: UnmatchedBracket Date: Wed, 25 Sep 2024 13:44:22 -0600 Subject: [PATCH 1/2] fix quake epicenter for first person and awayviews --- src/r_main.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/r_main.c b/src/r_main.c index 50293341d..dcb69b662 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -1152,8 +1152,14 @@ void R_SetupFrame(player_t *player) if (quake.epicenter) { // Calculate 3D distance from epicenter, using the camera. - fixed_t xydist = R_PointToDist2(thiscam->x, thiscam->y, quake.epicenter->x, quake.epicenter->y); - fixed_t dist = R_PointToDist2(0, thiscam->z, xydist, quake.epicenter->z); + fixed_t xydist, dist; + if (r_viewmobj == NULL) { + xydist = R_PointToDist2(thiscam->x, thiscam->y, quake.epicenter->x, quake.epicenter->y); + dist = R_PointToDist2(0, thiscam->z, xydist, quake.epicenter->z); + } else { + xydist = R_PointToDist2(r_viewmobj->x, r_viewmobj->y, quake.epicenter->x, quake.epicenter->y); + dist = R_PointToDist2(0, r_viewmobj->z, xydist, quake.epicenter->z); + } // More effect closer to epicenter, outside of radius = no effect if (!quake.radius || dist > quake.radius) From 491c77bd767ddfa81f47cd60e4ebd203ae5e5e3b Mon Sep 17 00:00:00 2001 From: Unmatched Bracket <2755-UnmatchedBracket@users.noreply.git.do.srb2.org> Date: Wed, 25 Sep 2024 20:40:34 +0000 Subject: [PATCH 2/2] [quake fixes] Use P_MobjWasRemoved instead of checking against NULL per Zapony's suggestion --- src/r_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/r_main.c b/src/r_main.c index dcb69b662..32e3138eb 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -1153,7 +1153,7 @@ void R_SetupFrame(player_t *player) if (quake.epicenter) { // Calculate 3D distance from epicenter, using the camera. fixed_t xydist, dist; - if (r_viewmobj == NULL) { + if (P_MobjWasRemoved(r_viewmobj)) { xydist = R_PointToDist2(thiscam->x, thiscam->y, quake.epicenter->x, quake.epicenter->y); dist = R_PointToDist2(0, thiscam->z, xydist, quake.epicenter->z); } else {