Merge branch 'clipmidtex' into extra-textures

This commit is contained in:
Lactozilla 2024-05-03 15:42:15 -03:00
parent 3bdd8f2b04
commit b4adb261a3
3 changed files with 17 additions and 11 deletions

View file

@ -1375,6 +1375,8 @@ static void P_LoadSidedefs(UINT8 *data)
sd->scalex_top = sd->scalex_mid = sd->scalex_bottom = FRACUNIT;
sd->scaley_top = sd->scaley_mid = sd->scaley_bottom = FRACUNIT;
sd->flags = 0;
P_InitSideEdges(sd);
P_SetSidedefSector(i, (UINT16)SHORT(msd->sector));
@ -2690,6 +2692,8 @@ static void P_WriteTextmap(void)
fprintf(f, "midpeg = true;\n");
if (wlines[i].flags & ML_MIDSOLID)
fprintf(f, "midsolid = true;\n");
if (wlines[i].flags & ML_CLIPMIDTEX)
fprintf(f, "clipmidtex = true;\n");
if (wlines[i].flags & ML_WRAPMIDTEX)
fprintf(f, "wrapmidtex = true;\n");
if (wlines[i].flags & ML_NONET)
@ -3155,6 +3159,7 @@ static void P_LoadTextmap(void)
sd->bottomtexture = R_TextureNumForName("-");
sd->sector = NULL;
sd->repeatcnt = 0;
sd->flags = 0;
P_InitSideEdges(sd);

View file

@ -631,10 +631,10 @@ typedef struct line_s
// Don't make available to Lua or I will find where you live
typedef enum
{
SIDEFLAG_CLIP_MIDTEX = 1<<4, // Like the line counterpart, but only for this side.
SIDEFLAG_WRAP_MIDTEX = 1<<5, // Like the line counterpart, but only for this side.
SIDEFLAG_CLIP_MIDTEX = 1 << 0, // Like the line counterpart, but only for this side.
SIDEFLAG_WRAP_MIDTEX = 1 << 1, // Like the line counterpart, but only for this side.
SIDEFLAG_HASEDGETEXTURES = 1<<13 // Side has an edge texture applied (so that the renderer can quickly skip all relevant code)
SIDEFLAG_HASEDGETEXTURES = 1 << 2 // Side has an edge texture applied (so that the renderer can quickly skip all relevant code)
} sideflags_t;
enum
@ -669,6 +669,7 @@ typedef struct side_s
fixed_t scalex_top, scalex_mid, scalex_bottom;
fixed_t scaley_top, scaley_mid, scaley_bottom;
// Rendering-related flags
UINT16 flags;
// Texture indices.

View file

@ -420,14 +420,13 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
rw_scalestep = scalestep;
spryscale = scale1 + (x1 - ds->x1)*rw_scalestep;
// Texture must be cached before setting colfunc_2s,
// otherwise texture[texnum]->holes may be false when it shouldn't be
// Texture must be cached
R_CheckTextureCache(texnum);
if (vertflip) // vertically flipped?
colfunc_2s = R_DrawFlippedMaskedColumn;
else
colfunc_2s = R_DrawMaskedColumn; // render the usual 2sided single-patch packed texture
colfunc_2s = R_DrawMaskedColumn;
lengthcol = textures[texnum]->height;
@ -564,7 +563,9 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
left_bottom += bottom_step;
}
sprtopscreen = centeryfrac - FixedMul(texture_top, spryscale);
// NB: sprtopscreen needs to start where dc_texturemid does, so that R_DrawMaskedColumn works correctly.
// windowtop however is set so that the column gets clipped properly.
sprtopscreen = centeryfrac - FixedMul(dc_texturemid, spryscale);
realbot = centeryfrac - FixedMul(texture_bottom, spryscale);
if (do_overlay_column)
@ -573,7 +574,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
// set wall bounds if necessary
if (dc_numlights || clipmidtex)
{
windowtop = sprtopscreen;
windowtop = centeryfrac - FixedMul(texture_top, spryscale);
windowbottom = realbot;
}
@ -710,14 +711,13 @@ static void R_RenderExtraTexture(unsigned which, INT32 x1, INT32 x2, INT32 repea
rw_scalestep = scalestep;
spryscale = scale1 + (x1 - ds->x1)*rw_scalestep;
// Texture must be cached before setting colfunc_2s,
// otherwise texture[texnum]->holes may be false when it shouldn't be
// Texture must be cached
R_CheckTextureCache(texnum);
if (vertflip) // vertically flipped?
colfunc_2s = R_DrawFlippedMaskedColumn;
else
colfunc_2s = R_DrawMaskedColumn; // render the usual 2sided single-patch packed texture
colfunc_2s = R_DrawMaskedColumn;
lengthcol = textures[texnum]->height;