From 0f8c7361880c6147c4b46f7724da9d229793380f Mon Sep 17 00:00:00 2001 From: James R Date: Wed, 8 Jan 2020 20:49:38 -0800 Subject: [PATCH 1/2] Don't make player transparent if the orbital camera is looking straight down --- src/p_user.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index 20fbc99f4..5bce0535d 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -10293,7 +10293,13 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall vy = player->awayviewmobj->y; } - if (P_AproxDistance(vx - mo->x, vy - mo->y) < FixedMul(48*FRACUNIT, mo->scale)) + /* + When the orbital camera looks straight down, its distance + will be very close to the player. So give it a threshold... + */ + if (( !( camorbit && rendermode == render_opengl ) || + focusaiming < ANGLE_90 || focusaiming > ANGLE_292h ) && + P_AproxDistance(vx - mo->x, vy - mo->y) < FixedMul(48*FRACUNIT, mo->scale)) mo->flags2 |= MF2_SHADOW; else mo->flags2 &= ~MF2_SHADOW; From 2459ca255f6df5b5e5767aa3813fceed07ab1cd7 Mon Sep 17 00:00:00 2001 From: James R Date: Fri, 10 Jan 2020 00:04:17 -0800 Subject: [PATCH 2/2] Factor z distance into camera translucency --- src/p_user.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 5bce0535d..5b7e50995 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -10287,19 +10287,17 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall if (!(multiplayer || netgame) && !splitscreen) { fixed_t vx = thiscam->x, vy = thiscam->y; + fixed_t vz = thiscam->z + thiscam->height / 2; if (player->awayviewtics && player->awayviewmobj != NULL && !P_MobjWasRemoved(player->awayviewmobj)) // Camera must obviously exist { vx = player->awayviewmobj->x; vy = player->awayviewmobj->y; + vz = player->awayviewmobj->z + player->awayviewmobj->height / 2; } - /* - When the orbital camera looks straight down, its distance - will be very close to the player. So give it a threshold... - */ - if (( !( camorbit && rendermode == render_opengl ) || - focusaiming < ANGLE_90 || focusaiming > ANGLE_292h ) && - P_AproxDistance(vx - mo->x, vy - mo->y) < FixedMul(48*FRACUNIT, mo->scale)) + /* check z distance too for orbital camera */ + if (P_AproxDistance(P_AproxDistance(vx - mo->x, vy - mo->y), + vz - ( mo->z + mo->height / 2 )) < FixedMul(48*FRACUNIT, mo->scale)) mo->flags2 |= MF2_SHADOW; else mo->flags2 &= ~MF2_SHADOW;