This commit is contained in:
Christoph Oelckers 2016-04-13 16:24:44 +02:00
commit d657692229
3 changed files with 7 additions and 3 deletions

View file

@ -731,7 +731,6 @@ void R_EnterPortal (PortalDrawseg* pds, int depth)
viewy = FLOAT2FIXED((y1 + r * dy)*2 - y); viewy = FLOAT2FIXED((y1 + r * dy)*2 - y);
} }
viewangle = pds->src->Delta().Angle().BAMs() - startang; viewangle = pds->src->Delta().Angle().BAMs() - startang;
ViewAngle = AngleToFloat(viewangle);
} }
else else
{ {
@ -763,6 +762,7 @@ void R_EnterPortal (PortalDrawseg* pds, int depth)
} }
} }
ViewAngle = AngleToFloat(viewangle); ViewAngle = AngleToFloat(viewangle);
ViewPos = { FIXED2DBL(viewx), FIXED2DBL(viewy), FIXED2DBL(viewz) };
viewsin = finesine[viewangle>>ANGLETOFINESHIFT]; viewsin = finesine[viewangle>>ANGLETOFINESHIFT];
viewcos = finecosine[viewangle>>ANGLETOFINESHIFT]; viewcos = finecosine[viewangle>>ANGLETOFINESHIFT];
@ -845,6 +845,7 @@ void R_EnterPortal (PortalDrawseg* pds, int depth)
ViewPath[0] = savedpath[0]; ViewPath[0] = savedpath[0];
ViewPath[1] = savedpath[1]; ViewPath[1] = savedpath[1];
ViewAngle = AngleToFloat(viewangle); ViewAngle = AngleToFloat(viewangle);
ViewPos = { FIXED2DBL(viewx), FIXED2DBL(viewy), FIXED2DBL(viewz) };
} }
//========================================================================== //==========================================================================

View file

@ -1083,6 +1083,7 @@ void R_DrawHeightPlanes(fixed_t height)
viewz = pl->viewz; viewz = pl->viewz;
viewangle = pl->viewangle; viewangle = pl->viewangle;
ViewAngle = AngleToFloat(viewangle); ViewAngle = AngleToFloat(viewangle);
ViewPos = { FIXED2DBL(viewx), FIXED2DBL(viewy), FIXED2DBL(viewz) };
MirrorFlags = pl->MirrorFlags; MirrorFlags = pl->MirrorFlags;
R_DrawSinglePlane (pl, pl->sky & 0x7FFFFFFF, pl->Additive, true); R_DrawSinglePlane (pl, pl->sky & 0x7FFFFFFF, pl->Additive, true);
} }
@ -1094,6 +1095,7 @@ void R_DrawHeightPlanes(fixed_t height)
viewz = oViewZ; viewz = oViewZ;
viewangle = oViewAngle; viewangle = oViewAngle;
ViewAngle = AngleToFloat(viewangle); ViewAngle = AngleToFloat(viewangle);
ViewPos = { FIXED2DBL(viewx), FIXED2DBL(viewy), FIXED2DBL(viewz) };
} }
@ -1256,6 +1258,7 @@ void R_DrawSkyBoxes ()
viewangle = pl->viewangle; viewangle = pl->viewangle;
} }
ViewAngle = AngleToFloat(viewangle); ViewAngle = AngleToFloat(viewangle);
ViewPos = { FIXED2DBL(viewx), FIXED2DBL(viewy), FIXED2DBL(viewz) };
sky->bInSkybox = true; sky->bInSkybox = true;
if (mate != NULL) mate->bInSkybox = true; if (mate != NULL) mate->bInSkybox = true;
@ -1371,6 +1374,7 @@ void R_DrawSkyBoxes ()
extralight = savedextralight; extralight = savedextralight;
viewangle = savedangle; viewangle = savedangle;
ViewAngle = AngleToFloat(viewangle); ViewAngle = AngleToFloat(viewangle);
ViewPos = { FIXED2DBL(viewx), FIXED2DBL(viewy), FIXED2DBL(viewz) };
R_SetViewAngle (); R_SetViewAngle ();
CurrentPortalInSkybox = false; CurrentPortalInSkybox = false;

View file

@ -1227,7 +1227,6 @@ static void R_ProjectWallSprite(AActor *thing, fixed_t fx, fixed_t fy, fixed_t f
void R_AddSprites (sector_t *sec, int lightlevel, int fakeside) void R_AddSprites (sector_t *sec, int lightlevel, int fakeside)
{ {
AActor *thing; AActor *thing;
F3DFloor *rover;
F3DFloor *fakeceiling = NULL; F3DFloor *fakeceiling = NULL;
F3DFloor *fakefloor = NULL; F3DFloor *fakefloor = NULL;
@ -1249,7 +1248,7 @@ void R_AddSprites (sector_t *sec, int lightlevel, int fakeside)
FIntCVar *cvar = thing->GetClass()->distancecheck; FIntCVar *cvar = thing->GetClass()->distancecheck;
if (cvar != NULL && *cvar >= 0) if (cvar != NULL && *cvar >= 0)
{ {
double dist = thing->Distance2DSquared(camera); double dist = (thing->PosRelative(viewsector) - ViewPos).LengthSquared();
double check = (double)**cvar; double check = (double)**cvar;
if (dist >= check * check) if (dist >= check * check)
{ {