Partially port newer sky rendering

Not the cause of the black sky bug, but doing this helped me diagnose it & it's cleaner
This commit is contained in:
Sally Coolatta 2022-05-01 21:48:48 -04:00
parent c35985d595
commit bf2b8490ea
2 changed files with 52 additions and 47 deletions

View file

@ -69,7 +69,7 @@ fixed_t viewx, viewy, viewz;
angle_t viewangle, aimingangle;
UINT8 viewssnum;
fixed_t viewcos, viewsin;
boolean viewsky, skyVisible;
boolean skyVisible;
boolean skyVisiblePerPlayer[MAXSPLITSCREENPLAYERS]; // saved values of skyVisible for each splitscreen player
sector_t *viewsector;
player_t *viewplayer;

View file

@ -27,6 +27,7 @@
#include "w_wad.h"
#include "z_zone.h"
#include "p_tick.h"
#include "r_fps.h"
#ifdef TIMING
#include "p5prof.h"
@ -678,8 +679,6 @@ void R_MakeSpans(INT32 x, INT32 t1, INT32 b1, INT32 t2, INT32 b2)
void R_DrawPlanes(void)
{
visplane_t *pl;
INT32 x;
INT32 angle;
INT32 i;
spanfunc = basespanfunc;
@ -689,18 +688,33 @@ void R_DrawPlanes(void)
{
for (pl = visplanes[i]; pl; pl = pl->next)
{
// sky flat
if (pl->picnum == skyflatnum)
{
if (!viewsky)
if (pl->ffloor != NULL || pl->polyobj != NULL)
continue;
R_DrawSinglePlane(pl);
}
}
#ifndef NOWATER
waterofs = (leveltime & 1)*16384;
wtofs = leveltime * 140;
#endif
}
static void R_DrawSkyPlane(visplane_t *pl)
{
INT32 x;
INT32 angle;
if (!newview->sky)
{
skyVisible = true;
continue;
return;
}
wallcolfunc = walldrawerfunc;
// use correct aspect ratio scale
dc_iscale = skyscale;
// Sky is always drawn full bright,
// i.e. colormaps[0] is used.
// Because of this hack, sky is not affected
@ -715,7 +729,6 @@ void R_DrawPlanes(void)
{
dc_yl = pl->top[x];
dc_yh = pl->bottom[x];
if (dc_yl <= dc_yh)
{
angle = (pl->viewangle + xtoviewangle[x])>>ANGLETOSKYSHIFT;
@ -727,21 +740,6 @@ void R_DrawPlanes(void)
wallcolfunc();
}
}
continue;
}
if (pl->ffloor != NULL
|| pl->polyobj != NULL
)
continue;
R_DrawSinglePlane(pl);
}
}
#ifndef NOWATER
waterofs = (leveltime & 1)*16384;
wtofs = leveltime * 140;
#endif
}
void R_DrawSinglePlane(visplane_t *pl)
@ -755,6 +753,13 @@ void R_DrawSinglePlane(visplane_t *pl)
if (!(pl->minx <= pl->maxx))
return;
// sky flat
if (pl->picnum == skyflatnum)
{
R_DrawSkyPlane(pl);
return;
}
#ifndef NOWATER
itswater = false;
#endif