diff --git a/src/r_main.cpp b/src/r_main.cpp index 8e7452789..1c15f9f1e 100644 --- a/src/r_main.cpp +++ b/src/r_main.cpp @@ -731,7 +731,6 @@ void R_EnterPortal (PortalDrawseg* pds, int depth) viewy = FLOAT2FIXED((y1 + r * dy)*2 - y); } viewangle = pds->src->Delta().Angle().BAMs() - startang; - ViewAngle = AngleToFloat(viewangle); } else { @@ -763,6 +762,7 @@ void R_EnterPortal (PortalDrawseg* pds, int depth) } } ViewAngle = AngleToFloat(viewangle); + ViewPos = { FIXED2DBL(viewx), FIXED2DBL(viewy), FIXED2DBL(viewz) }; viewsin = finesine[viewangle>>ANGLETOFINESHIFT]; viewcos = finecosine[viewangle>>ANGLETOFINESHIFT]; @@ -845,6 +845,7 @@ void R_EnterPortal (PortalDrawseg* pds, int depth) ViewPath[0] = savedpath[0]; ViewPath[1] = savedpath[1]; ViewAngle = AngleToFloat(viewangle); + ViewPos = { FIXED2DBL(viewx), FIXED2DBL(viewy), FIXED2DBL(viewz) }; } //========================================================================== diff --git a/src/r_plane.cpp b/src/r_plane.cpp index 087487cd5..d950075db 100644 --- a/src/r_plane.cpp +++ b/src/r_plane.cpp @@ -1083,6 +1083,7 @@ void R_DrawHeightPlanes(fixed_t height) viewz = pl->viewz; viewangle = pl->viewangle; ViewAngle = AngleToFloat(viewangle); + ViewPos = { FIXED2DBL(viewx), FIXED2DBL(viewy), FIXED2DBL(viewz) }; MirrorFlags = pl->MirrorFlags; R_DrawSinglePlane (pl, pl->sky & 0x7FFFFFFF, pl->Additive, true); } @@ -1094,6 +1095,7 @@ void R_DrawHeightPlanes(fixed_t height) viewz = oViewZ; viewangle = oViewAngle; ViewAngle = AngleToFloat(viewangle); + ViewPos = { FIXED2DBL(viewx), FIXED2DBL(viewy), FIXED2DBL(viewz) }; } @@ -1256,6 +1258,7 @@ void R_DrawSkyBoxes () viewangle = pl->viewangle; } ViewAngle = AngleToFloat(viewangle); + ViewPos = { FIXED2DBL(viewx), FIXED2DBL(viewy), FIXED2DBL(viewz) }; sky->bInSkybox = true; if (mate != NULL) mate->bInSkybox = true; @@ -1371,6 +1374,7 @@ void R_DrawSkyBoxes () extralight = savedextralight; viewangle = savedangle; ViewAngle = AngleToFloat(viewangle); + ViewPos = { FIXED2DBL(viewx), FIXED2DBL(viewy), FIXED2DBL(viewz) }; R_SetViewAngle (); CurrentPortalInSkybox = false; diff --git a/src/r_things.cpp b/src/r_things.cpp index 7fe8ab017..cc490e6b0 100644 --- a/src/r_things.cpp +++ b/src/r_things.cpp @@ -1248,7 +1248,7 @@ void R_AddSprites (sector_t *sec, int lightlevel, int fakeside) FIntCVar *cvar = thing->GetClass()->distancecheck; if (cvar != NULL && *cvar >= 0) { - double dist = thing->Distance2DSquared(camera); + double dist = (thing->PosRelative(viewsector) - ViewPos).LengthSquared(); double check = (double)**cvar; if (dist >= check * check) {