mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-11-10 15:22:20 +00:00
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:
parent
c35985d595
commit
bf2b8490ea
2 changed files with 52 additions and 47 deletions
|
@ -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;
|
||||
|
|
|
@ -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,50 +688,7 @@ void R_DrawPlanes(void)
|
|||
{
|
||||
for (pl = visplanes[i]; pl; pl = pl->next)
|
||||
{
|
||||
// sky flat
|
||||
if (pl->picnum == skyflatnum)
|
||||
{
|
||||
if (!viewsky)
|
||||
{
|
||||
skyVisible = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
// 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
|
||||
// by INVUL inverse mapping.
|
||||
dc_colormap = colormaps;
|
||||
if (encoremap)
|
||||
dc_colormap += (256*32);
|
||||
dc_texturemid = skytexturemid;
|
||||
dc_texheight = textureheight[skytexture]
|
||||
>>FRACBITS;
|
||||
for (x = pl->minx; x <= pl->maxx; x++)
|
||||
{
|
||||
dc_yl = pl->top[x];
|
||||
dc_yh = pl->bottom[x];
|
||||
|
||||
if (dc_yl <= dc_yh)
|
||||
{
|
||||
angle = (pl->viewangle + xtoviewangle[x])>>ANGLETOSKYSHIFT;
|
||||
dc_iscale = FixedMul(skyscale, FINECOSINE(xtoviewangle[x]>>ANGLETOFINESHIFT));
|
||||
dc_x = x;
|
||||
dc_source =
|
||||
R_GetColumn(texturetranslation[skytexture],
|
||||
angle);
|
||||
wallcolfunc();
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (pl->ffloor != NULL
|
||||
|| pl->polyobj != NULL
|
||||
)
|
||||
if (pl->ffloor != NULL || pl->polyobj != NULL)
|
||||
continue;
|
||||
|
||||
R_DrawSinglePlane(pl);
|
||||
|
@ -744,6 +700,48 @@ void R_DrawPlanes(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
static void R_DrawSkyPlane(visplane_t *pl)
|
||||
{
|
||||
INT32 x;
|
||||
INT32 angle;
|
||||
|
||||
if (!newview->sky)
|
||||
{
|
||||
skyVisible = true;
|
||||
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
|
||||
// by INVUL inverse mapping.
|
||||
dc_colormap = colormaps;
|
||||
if (encoremap)
|
||||
dc_colormap += (256*32);
|
||||
dc_texturemid = skytexturemid;
|
||||
dc_texheight = textureheight[skytexture]
|
||||
>>FRACBITS;
|
||||
for (x = pl->minx; x <= pl->maxx; x++)
|
||||
{
|
||||
dc_yl = pl->top[x];
|
||||
dc_yh = pl->bottom[x];
|
||||
if (dc_yl <= dc_yh)
|
||||
{
|
||||
angle = (pl->viewangle + xtoviewangle[x])>>ANGLETOSKYSHIFT;
|
||||
dc_iscale = FixedMul(skyscale, FINECOSINE(xtoviewangle[x]>>ANGLETOFINESHIFT));
|
||||
dc_x = x;
|
||||
dc_source =
|
||||
R_GetColumn(texturetranslation[skytexture],
|
||||
angle);
|
||||
wallcolfunc();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void R_DrawSinglePlane(visplane_t *pl)
|
||||
{
|
||||
INT32 light = 0;
|
||||
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue