- 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 secy;
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)
{
// For the actual camera sector use the current viewpoint as reference.
secx = r_viewpoint.Pos.X;
secy = r_viewpoint.Pos.Y;
secx = vp.Pos.X;
secy = vp.Pos.Y;
}
else
{

View File

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

View File

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

View File

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

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.
if (!fullbright)
{
const auto &vpp = r_viewpoint.Pos;
if (!viewsector->e->XFloor.ffloors.Size())
{
if (viewsector->GetHeightSec())
{
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
@ -1357,11 +1358,11 @@ void DFrameBuffer::DrawBlend(sector_t * viewsector)
{
double lightbottom;
if (i < lightlist.Size() - 1)
lightbottom = lightlist[i + 1].plane.ZatPoint(r_viewpoint.Pos);
lightbottom = lightlist[i + 1].plane.ZatPoint(vpp);
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
blendv = lightlist[i].blend;

View File

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