From 548ccb1df446a49e4fa58dabbe49a4563e6bb7d2 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 19 Jun 2018 11:20:36 +0200 Subject: [PATCH] - removed some references to r_viewpoint in game code Mainly to reduce number of search results. --- src/am_map.cpp | 7 ++++--- src/d_main.cpp | 11 ++++++----- src/events.cpp | 13 +++++++------ src/posix/sdl/i_main.cpp | 9 +++++---- src/v_draw.cpp | 9 +++++---- src/win32/i_main.cpp | 9 +++++---- 6 files changed, 32 insertions(+), 26 deletions(-) diff --git a/src/am_map.cpp b/src/am_map.cpp index 20f99de36..e0296e797 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -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 { diff --git a/src/d_main.cpp b/src/d_main.cpp index c507ecc57..4172909bc 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -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(); diff --git a/src/events.cpp b/src/events.cpp index c520359a5..eabf1b931 100755 --- a/src/events.cpp +++ b/src/events.cpp @@ -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; } diff --git a/src/posix/sdl/i_main.cpp b/src/posix/sdl/i_main.cpp index 127198df8..38f035515 100644 --- a/src/posix/sdl/i_main.cpp +++ b/src/posix/sdl/i_main.cpp @@ -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'; diff --git a/src/v_draw.cpp b/src/v_draw.cpp index f43bffd19..49e445995 100644 --- a/src/v_draw.cpp +++ b/src/v_draw.cpp @@ -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; diff --git a/src/win32/i_main.cpp b/src/win32/i_main.cpp index 21b758094..b1d7a7bb7 100644 --- a/src/win32/i_main.cpp +++ b/src/win32/i_main.cpp @@ -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';