Implement brightmaps for span drawers, fix column loop bug

This commit is contained in:
Sally Coolatta 2021-12-16 11:48:32 -05:00
parent 04c1a9dcb1
commit daab86f461
5 changed files with 642 additions and 388 deletions

View file

@ -110,6 +110,7 @@ INT32 dc_numlights = 0, dc_maxlights, dc_texheight;
INT32 ds_y, ds_x1, ds_x2;
lighttable_t *ds_colormap;
lighttable_t *ds_fullbright;
lighttable_t *ds_translation; // Lactozilla: Sprite splat drawer
fixed_t ds_xfrac, ds_yfrac, ds_xstep, ds_ystep;
@ -119,6 +120,7 @@ UINT16 ds_flatwidth, ds_flatheight;
boolean ds_powersoftwo;
UINT8 *ds_source; // points to the start of a flat
UINT8 *ds_brightmap; // start of brightmap flat
UINT8 *ds_transmap; // one of the translucency tables
// Vectors for Software's tilted slope drawers

View file

@ -59,6 +59,7 @@ extern INT32 dc_texheight;
extern INT32 ds_y, ds_x1, ds_x2;
extern lighttable_t *ds_colormap;
extern lighttable_t *ds_fullbright;
extern lighttable_t *ds_translation;
extern fixed_t ds_xfrac, ds_yfrac, ds_xstep, ds_ystep;
@ -68,6 +69,7 @@ extern UINT16 ds_flatwidth, ds_flatheight;
extern boolean ds_powersoftwo;
extern UINT8 *ds_source;
extern UINT8 *ds_brightmap;
extern UINT8 *ds_transmap;
typedef struct {

File diff suppressed because it is too large Load diff

View file

@ -235,7 +235,9 @@ void R_MapPlane(INT32 y, INT32 x1, INT32 x2)
}
if (currentplane->slope)
{
ds_colormap = colormaps;
}
else
{
pindex = distance >> LIGHTZSHIFT;
@ -244,8 +246,13 @@ void R_MapPlane(INT32 y, INT32 x1, INT32 x2)
ds_colormap = planezlight[pindex];
}
ds_fullbright = colormaps;
if (encoremap && !currentplane->noencore)
{
ds_colormap += COLORMAP_REMAPOFFSET;
ds_fullbright += COLORMAP_REMAPOFFSET;
}
if (currentplane->extra_colormap)
ds_colormap = currentplane->extra_colormap->colormap + (ds_colormap - colormaps);
@ -970,6 +977,30 @@ void R_DrawSinglePlane(visplane_t *pl)
R_CheckFlatLength(ds_flatwidth * ds_flatheight);
}
ds_brightmap = NULL;
if (type == LEVELFLAT_TEXTURE)
{
// Get the span's brightmap.
// FLATS not supported, SORRY!!
INT32 texNum = R_GetTextureNum(levelflat->u.texture.num);
INT32 bmNum = R_GetTextureBrightmap(texNum);
if (bmNum != 0)
{
texture_t *brightmap = textures[bmNum];
if (brightmap->flat == NULL)
{
ds_brightmap = R_GenerateTextureAsFlat(bmNum);
}
else
{
ds_brightmap = (UINT8 *)brightmap->flat;
}
}
}
if (!pl->slope // Don't mess with angle on slopes! We'll handle this ourselves later
&& viewangle != pl->viewangle+pl->plangle)
{

View file

@ -444,6 +444,7 @@ static void R_RasterizeFloorSplat(floorsplat_t *pSplat, vector2_t *verts, visspr
}
ds_colormap = vis->colormap;
ds_fullbright = colormaps;
ds_translation = R_GetSpriteTranslation(vis);
if (ds_translation == NULL)
ds_translation = colormaps;