mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-29 20:50:58 +00:00
Move sky plane-drawing code from R_DrawPlanes to a new function called by R_DrawSinglePlane
This potentially allows FOFs and polyobjects to display sky flats on them properly, unless skyboxes are involved in which case they'd fail either way I also updated or added comments to some places of the sky drawing code and related where useful
This commit is contained in:
parent
f9a0ef517d
commit
f6c740840a
1 changed files with 62 additions and 41 deletions
|
@ -694,10 +694,10 @@ void R_MakeSpans(INT32 x, INT32 t1, INT32 b1, INT32 t2, INT32 b2)
|
||||||
void R_DrawPlanes(void)
|
void R_DrawPlanes(void)
|
||||||
{
|
{
|
||||||
visplane_t *pl;
|
visplane_t *pl;
|
||||||
INT32 x;
|
|
||||||
INT32 angle;
|
|
||||||
INT32 i;
|
INT32 i;
|
||||||
|
|
||||||
|
// Note: are these two lines really needed?
|
||||||
|
// R_DrawSinglePlane and R_DrawSkyPlane do span/column drawer resets themselves anyway
|
||||||
spanfunc = basespanfunc;
|
spanfunc = basespanfunc;
|
||||||
wallcolfunc = walldrawerfunc;
|
wallcolfunc = walldrawerfunc;
|
||||||
|
|
||||||
|
@ -705,22 +705,53 @@ void R_DrawPlanes(void)
|
||||||
{
|
{
|
||||||
for (pl = visplanes[i]; pl; pl = pl->next)
|
for (pl = visplanes[i]; pl; pl = pl->next)
|
||||||
{
|
{
|
||||||
// sky flat
|
if (pl->ffloor != NULL
|
||||||
if (pl->picnum == skyflatnum)
|
#ifdef POLYOBJECTS_PLANES
|
||||||
{
|
|| pl->polyobj != NULL
|
||||||
|
#endif
|
||||||
|
)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
R_DrawSinglePlane(pl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#ifndef NOWATER
|
||||||
|
waterofs = (leveltime & 1)*16384;
|
||||||
|
wtofs = leveltime * 140;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// R_DrawSkyPlane
|
||||||
|
//
|
||||||
|
// Draws the sky within the plane's top/bottom bounds
|
||||||
|
// Note: this uses column drawers instead of span drawers, since the sky is always a texture
|
||||||
|
//
|
||||||
|
static void R_DrawSkyPlane(visplane_t *pl)
|
||||||
|
{
|
||||||
|
INT32 x;
|
||||||
|
INT32 angle;
|
||||||
|
|
||||||
|
// If we're not supposed to draw the sky (e.g. for skyboxes), don't do anything!
|
||||||
|
// This probably utterly ruins sky rendering for FOFs and polyobjects, unfortunately
|
||||||
if (!viewsky)
|
if (!viewsky)
|
||||||
{
|
{
|
||||||
|
// Mark that the sky was visible here for next tic
|
||||||
|
// (note: this is a hack and it sometimes can cause HOMs to appear for a tic IIRC)
|
||||||
skyVisible = true;
|
skyVisible = true;
|
||||||
continue;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reset column drawer function (note: couldn't we just call walldrawerfunc directly?)
|
||||||
|
// (that is, unless we'll need to switch drawers in future for some reason)
|
||||||
|
wallcolfunc = walldrawerfunc;
|
||||||
|
|
||||||
// use correct aspect ratio scale
|
// use correct aspect ratio scale
|
||||||
dc_iscale = skyscale;
|
dc_iscale = skyscale;
|
||||||
|
|
||||||
// Sky is always drawn full bright,
|
// Sky is always drawn full bright,
|
||||||
// i.e. colormaps[0] is used.
|
// i.e. colormaps[0] is used.
|
||||||
// Because of this hack, sky is not affected
|
// Because of this hack, sky is not affected
|
||||||
// by INVUL inverse mapping.
|
// by sector colormaps (INVUL inverse mapping is not implemented in SRB2 so is irrelevant).
|
||||||
dc_colormap = colormaps;
|
dc_colormap = colormaps;
|
||||||
dc_texturemid = skytexturemid;
|
dc_texturemid = skytexturemid;
|
||||||
dc_texheight = textureheight[skytexture]
|
dc_texheight = textureheight[skytexture]
|
||||||
|
@ -741,23 +772,6 @@ void R_DrawPlanes(void)
|
||||||
wallcolfunc();
|
wallcolfunc();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pl->ffloor != NULL
|
|
||||||
#ifdef POLYOBJECTS_PLANES
|
|
||||||
|| pl->polyobj != NULL
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
R_DrawSinglePlane(pl);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#ifndef NOWATER
|
|
||||||
waterofs = (leveltime & 1)*16384;
|
|
||||||
wtofs = leveltime * 140;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void R_DrawSinglePlane(visplane_t *pl)
|
void R_DrawSinglePlane(visplane_t *pl)
|
||||||
|
@ -771,6 +785,13 @@ void R_DrawSinglePlane(visplane_t *pl)
|
||||||
if (!(pl->minx <= pl->maxx))
|
if (!(pl->minx <= pl->maxx))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// sky flat
|
||||||
|
if (pl->picnum == skyflatnum)
|
||||||
|
{
|
||||||
|
R_DrawSkyPlane(pl);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef NOWATER
|
#ifndef NOWATER
|
||||||
itswater = false;
|
itswater = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue