Don't generate textures in R_GetColumn

This commit is contained in:
Lactozilla 2023-08-01 19:04:47 -03:00
parent 689fa265dd
commit 9d7a734acc
3 changed files with 17 additions and 18 deletions

View file

@ -641,35 +641,31 @@ void R_DrawPlanes(void)
//
static void R_DrawSkyPlane(visplane_t *pl)
{
INT32 x;
INT32 angle;
INT32 texture = texturetranslation[skytexture];
// 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)
colfunc = colfuncs[BASEDRAWFUNC];
// 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 sector colormaps (INVUL inverse mapping is not implemented in SRB2 so is irrelevant).
dc_colormap = colormaps;
dc_texturemid = skytexturemid;
dc_texheight = textureheight[skytexture]
>>FRACBITS;
for (x = pl->minx; x <= pl->maxx; x++)
dc_texheight = textureheight[texture]>>FRACBITS;
R_CheckTextureCache(texture);
for (INT32 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;
INT32 angle = (pl->viewangle + xtoviewangle[x])>>ANGLETOSKYSHIFT;
dc_iscale = FixedMul(skyscale, FINECOSINE(xtoviewangle[x]>>ANGLETOFINESHIFT));
dc_x = x;
dc_source = R_GetColumn(texturetranslation[skytexture], -angle)->pixels; // get negative of angle for each column to display sky correct way round! --Monster Iestyn 27/01/18
dc_source = R_GetColumn(texture, -angle)->pixels; // get negative of angle for each column to display sky correct way round! --Monster Iestyn 27/01/18
colfunc();
}
}

View file

@ -1095,6 +1095,13 @@ static void R_RenderSegLoop (void)
INT32 bottom;
INT32 i;
if (midtexture)
R_CheckTextureCache(midtexture);
if (toptexture)
R_CheckTextureCache(toptexture);
if (bottomtexture)
R_CheckTextureCache(bottomtexture);
for (; rw_x < rw_stopx; rw_x++)
{
// mark floor / ceiling areas
@ -1333,7 +1340,7 @@ static void R_RenderSegLoop (void)
dc_yl = yl;
dc_yh = yh;
dc_texturemid = rw_midtexturemid;
dc_source = R_GetColumn(midtexture,texturecolumn + (rw_offset_mid>>FRACBITS))->pixels;
dc_source = R_GetColumn(midtexture, texturecolumn + (rw_offset_mid>>FRACBITS))->pixels;
dc_texheight = textureheight[midtexture]>>FRACBITS;
//profile stuff ---------------------------------------------------------
@ -1394,7 +1401,7 @@ static void R_RenderSegLoop (void)
dc_yl = yl;
dc_yh = mid;
dc_texturemid = rw_toptexturemid;
dc_source = R_GetColumn(toptexture,texturecolumn + (rw_offset_top>>FRACBITS))->pixels;
dc_source = R_GetColumn(toptexture, texturecolumn + (rw_offset_top>>FRACBITS))->pixels;
dc_texheight = textureheight[toptexture]>>FRACBITS;
colfunc();
ceilingclip[rw_x] = (INT16)mid;

View file

@ -498,10 +498,6 @@ column_t *R_GetColumn(fixed_t tex, INT32 col)
else
col &= (width - 1);
UINT8 *data = texturecache[tex];
if (!data)
R_GenerateTexture(tex);
return &texturecolumns[tex][col];
}