- removed some references to r_viewpoint in game code

Mainly to reduce number of search results.
This commit is contained in:
Christoph Oelckers 2018-06-19 11:20:36 +02:00
parent 86975a71e8
commit 548ccb1df4
6 changed files with 32 additions and 26 deletions

View file

@ -2123,13 +2123,14 @@ void AM_drawSubsectors()
double secx; double secx;
double secy; double secy;
double seczb, seczt; double seczb, seczt;
double cmpz = r_viewpoint.Pos.Z; auto &vp = r_viewpoint;
double cmpz = vp.Pos.Z;
if (players[consoleplayer].camera && sec == players[consoleplayer].camera->Sector) if (players[consoleplayer].camera && sec == players[consoleplayer].camera->Sector)
{ {
// For the actual camera sector use the current viewpoint as reference. // For the actual camera sector use the current viewpoint as reference.
secx = r_viewpoint.Pos.X; secx = vp.Pos.X;
secy = r_viewpoint.Pos.Y; secy = vp.Pos.Y;
} }
else else
{ {

View file

@ -679,6 +679,7 @@ void D_Display ()
players[consoleplayer].camera = players[consoleplayer].mo; players[consoleplayer].camera = players[consoleplayer].mo;
} }
auto &vp = r_viewpoint;
if (viewactive) if (viewactive)
{ {
DAngle fov = 90.f; DAngle fov = 90.f;
@ -689,7 +690,7 @@ void D_Display ()
fov = cam->player->FOV; fov = cam->player->FOV;
else fov = cam->CameraFOV; else fov = cam->CameraFOV;
} }
R_SetFOV(r_viewpoint, fov); R_SetFOV(vp, fov);
} }
// [RH] change the screen mode if needed // [RH] change the screen mode if needed
@ -718,7 +719,7 @@ void D_Display ()
// change the view size if needed // change the view size if needed
if (setsizeneeded && StatusBar != NULL) if (setsizeneeded && StatusBar != NULL)
{ {
R_ExecuteSetViewSize (r_viewpoint, r_viewwindow); R_ExecuteSetViewSize (vp, r_viewwindow);
} }
setmodeneeded = false; setmodeneeded = false;
@ -817,7 +818,7 @@ void D_Display ()
{ {
StatusBar->DrawCrosshair(); StatusBar->DrawCrosshair();
} }
StatusBar->CallDraw (HUD_AltHud, r_viewpoint.TicFrac); StatusBar->CallDraw (HUD_AltHud, vp.TicFrac);
StatusBar->DrawTopStuff (HUD_AltHud); StatusBar->DrawTopStuff (HUD_AltHud);
} }
else else
@ -825,13 +826,13 @@ void D_Display ()
{ {
EHudState state = DrawFSHUD ? HUD_Fullscreen : HUD_None; EHudState state = DrawFSHUD ? HUD_Fullscreen : HUD_None;
StatusBar->DrawBottomStuff (state); StatusBar->DrawBottomStuff (state);
StatusBar->CallDraw (state, r_viewpoint.TicFrac); StatusBar->CallDraw (state, vp.TicFrac);
StatusBar->DrawTopStuff (state); StatusBar->DrawTopStuff (state);
} }
else else
{ {
StatusBar->DrawBottomStuff (HUD_StatusBar); StatusBar->DrawBottomStuff (HUD_StatusBar);
StatusBar->CallDraw (HUD_StatusBar, r_viewpoint.TicFrac); StatusBar->CallDraw (HUD_StatusBar, vp.TicFrac);
StatusBar->DrawTopStuff (HUD_StatusBar); StatusBar->DrawTopStuff (HUD_StatusBar);
} }
//stb.Unclock(); //stb.Unclock();

View file

@ -857,12 +857,13 @@ void DStaticEventHandler::WorldTick()
static FRenderEvent E_SetupRenderEvent() static FRenderEvent E_SetupRenderEvent()
{ {
FRenderEvent e; FRenderEvent e;
e.ViewPos = r_viewpoint.Pos; auto &vp = r_viewpoint;
e.ViewAngle = r_viewpoint.Angles.Yaw; e.ViewPos = vp.Pos;
e.ViewPitch = r_viewpoint.Angles.Pitch; e.ViewAngle = vp.Angles.Yaw;
e.ViewRoll = r_viewpoint.Angles.Roll; e.ViewPitch = vp.Angles.Pitch;
e.FracTic = r_viewpoint.TicFrac; e.ViewRoll = vp.Angles.Roll;
e.Camera = r_viewpoint.camera; e.FracTic = vp.TicFrac;
e.Camera = vp.camera;
return e; return e;
} }

View file

@ -169,10 +169,11 @@ static int DoomSpecificInfo (char *buffer, char *end)
} }
else else
{ {
p += snprintf (buffer+p, size-p, "\n\nviewx = %f", r_viewpoint.Pos.X); auto &vp = r_viewpoint;
p += snprintf (buffer+p, size-p, "\nviewy = %f", r_viewpoint.Pos.Y); p += snprintf (buffer+p, size-p, "\n\nviewx = %f", vp.Pos.X);
p += snprintf (buffer+p, size-p, "\nviewz = %f", r_viewpoint.Pos.Z); p += snprintf (buffer+p, size-p, "\nviewy = %f", vp.Pos.Y);
p += snprintf (buffer+p, size-p, "\nviewangle = %f", r_viewpoint.Angles.Yaw.Degrees); p += snprintf (buffer+p, size-p, "\nviewz = %f", vp.Pos.Z);
p += snprintf (buffer+p, size-p, "\nviewangle = %f", vp.Angles.Yaw.Degrees);
} }
} }
buffer[p++] = '\n'; buffer[p++] = '\n';

View file

@ -1341,12 +1341,13 @@ void DFrameBuffer::DrawBlend(sector_t * viewsector)
// don't draw sector based blends when any fullbright screen effect is active. // don't draw sector based blends when any fullbright screen effect is active.
if (!fullbright) if (!fullbright)
{ {
const auto &vpp = r_viewpoint.Pos;
if (!viewsector->e->XFloor.ffloors.Size()) if (!viewsector->e->XFloor.ffloors.Size())
{ {
if (viewsector->GetHeightSec()) if (viewsector->GetHeightSec())
{ {
auto s = viewsector->heightsec; auto s = viewsector->heightsec;
blendv = s->floorplane.PointOnSide(r_viewpoint.Pos) < 0 ? s->bottommap : s->ceilingplane.PointOnSide(r_viewpoint.Pos) < 0 ? s->topmap : s->midmap; blendv = s->floorplane.PointOnSide(vpp) < 0 ? s->bottommap : s->ceilingplane.PointOnSide(vpp) < 0 ? s->topmap : s->midmap;
} }
} }
else else
@ -1357,11 +1358,11 @@ void DFrameBuffer::DrawBlend(sector_t * viewsector)
{ {
double lightbottom; double lightbottom;
if (i < lightlist.Size() - 1) if (i < lightlist.Size() - 1)
lightbottom = lightlist[i + 1].plane.ZatPoint(r_viewpoint.Pos); lightbottom = lightlist[i + 1].plane.ZatPoint(vpp);
else else
lightbottom = viewsector->floorplane.ZatPoint(r_viewpoint.Pos); lightbottom = viewsector->floorplane.ZatPoint(vpp);
if (lightbottom < r_viewpoint.Pos.Z && (!lightlist[i].caster || !(lightlist[i].caster->flags&FF_FADEWALLS))) if (lightbottom < vpp.Z && (!lightlist[i].caster || !(lightlist[i].caster->flags&FF_FADEWALLS)))
{ {
// 3d floor 'fog' is rendered as a blending value // 3d floor 'fog' is rendered as a blending value
blendv = lightlist[i].blend; blendv = lightlist[i].blend;

View file

@ -1105,10 +1105,11 @@ void DoomSpecificInfo (char *buffer, size_t bufflen)
} }
else else
{ {
buffer += mysnprintf (buffer, buffend - buffer, "\r\n\r\nviewx = %f", r_viewpoint.Pos.X); auto &vp = r_viewpoint;
buffer += mysnprintf (buffer, buffend - buffer, "\r\nviewy = %f", r_viewpoint.Pos.Y); buffer += mysnprintf (buffer, buffend - buffer, "\r\n\r\nviewx = %f", vp.Pos.X);
buffer += mysnprintf (buffer, buffend - buffer, "\r\nviewz = %f", r_viewpoint.Pos.Z); buffer += mysnprintf (buffer, buffend - buffer, "\r\nviewy = %f", vp.Pos.Y);
buffer += mysnprintf (buffer, buffend - buffer, "\r\nviewangle = %f", r_viewpoint.Angles.Yaw); buffer += mysnprintf (buffer, buffend - buffer, "\r\nviewz = %f", vp.Pos.Z);
buffer += mysnprintf (buffer, buffend - buffer, "\r\nviewangle = %f", vp.Angles.Yaw);
} }
} }
*buffer++ = '\r'; *buffer++ = '\r';