diff --git a/src/swrenderer/r_main.cpp b/src/swrenderer/r_main.cpp index 5d672c2804..37295fe7bd 100644 --- a/src/swrenderer/r_main.cpp +++ b/src/swrenderer/r_main.cpp @@ -68,6 +68,8 @@ #include "p_maputl.h" #include "p_setup.h" #include "version.h" +#include "c_console.h" +#include "r_memory.h" CVAR (String, r_viewsize, "", CVAR_NOSET) CVAR (Bool, r_shadercolormaps, true, CVAR_ARCHIVE) @@ -554,6 +556,12 @@ void R_RenderActorView (AActor *actor, bool dontmaplines) R_ClearPlanes (true); R_ClearSprites (); + // opening / clipping determination + // [RH] clip ceiling to console bottom + fillshort(floorclip, viewwidth, viewheight); + fillshort(ceilingclip, viewwidth, !screen->Accel2D && ConBottom > viewwindowy && !bRenderingToCanvas ? (ConBottom - viewwindowy) : 0); + R_FreeOpenings(); + NetUpdate (); // [RH] Show off segs if r_drawflat is 1 diff --git a/src/swrenderer/r_main.h b/src/swrenderer/r_main.h index 1a62eccf10..4f6b00a1b5 100644 --- a/src/swrenderer/r_main.h +++ b/src/swrenderer/r_main.h @@ -133,10 +133,6 @@ void R_RenderViewToCanvas (AActor *actor, DCanvas *canvas, int x, int y, int wid void R_MultiresInit (void); -extern int stacked_extralight; -extern double stacked_visibility; -extern DVector3 stacked_viewpos; -extern DAngle stacked_angle; extern void R_CopyStackedViewParameters(); diff --git a/src/swrenderer/scene/r_plane.cpp b/src/swrenderer/scene/r_plane.cpp index 397b5efde4..f18d1e533f 100644 --- a/src/swrenderer/scene/r_plane.cpp +++ b/src/swrenderer/scene/r_plane.cpp @@ -80,23 +80,11 @@ namespace swrenderer { using namespace drawerargs; -extern subsector_t *InSubsector; - -// These are copies of the main parameters used when drawing stacked sectors. -// When you change the main parameters, you should copy them here too *unless* -// you are changing them to draw a stacked sector. Otherwise, stacked sectors -// won't draw in skyboxes properly. -int stacked_extralight; -double stacked_visibility; -DVector3 stacked_viewpos; -DAngle stacked_angle; - -// -// texture mapping -// - -short spanend[MAXHEIGHT]; +namespace +{ + short spanend[MAXHEIGHT]; +} void R_DrawSinglePlane (visplane_t *, fixed_t alpha, bool additive, bool masked); @@ -192,15 +180,6 @@ void R_ClearPlanes (bool fullclear) } } - // opening / clipping determination - fillshort (floorclip, viewwidth, viewheight); - // [RH] clip ceiling to console bottom - fillshort (ceilingclip, viewwidth, - !screen->Accel2D && ConBottom > viewwindowy && !bRenderingToCanvas - ? (ConBottom - viewwindowy) : 0); - - R_FreeOpenings(); - next_plane_light = 0; } } diff --git a/src/swrenderer/scene/r_portal.cpp b/src/swrenderer/scene/r_portal.cpp index 98c3d8af85..e48a47c869 100644 --- a/src/swrenderer/scene/r_portal.cpp +++ b/src/swrenderer/scene/r_portal.cpp @@ -54,6 +54,15 @@ namespace swrenderer int CurrentPortalUniq = 0; bool CurrentPortalInSkybox = false; + // These are copies of the main parameters used when drawing stacked sectors. + // When you change the main parameters, you should copy them here too *unless* + // you are changing them to draw a stacked sector. Otherwise, stacked sectors + // won't draw in skyboxes properly. + int stacked_extralight; + double stacked_visibility; + DVector3 stacked_viewpos; + DAngle stacked_angle; + namespace { int numskyboxes; // For ADD_STAT(skyboxes) diff --git a/src/swrenderer/scene/r_portal.h b/src/swrenderer/scene/r_portal.h index 32b6463ca3..42cec48913 100644 --- a/src/swrenderer/scene/r_portal.h +++ b/src/swrenderer/scene/r_portal.h @@ -9,6 +9,11 @@ namespace swrenderer extern int CurrentPortalUniq; extern bool CurrentPortalInSkybox; + extern int stacked_extralight; + extern double stacked_visibility; + extern DVector3 stacked_viewpos; + extern DAngle stacked_angle; + void R_DrawPortals(); void R_DrawWallPortals(); void R_EnterPortal(PortalDrawseg* pds, int depth);