Translucent affine functions

Up next is... column splitting. Dear god.
This commit is contained in:
yamamama 2026-02-27 01:38:12 -05:00
parent e802de23df
commit 402b48342b
4 changed files with 30 additions and 2 deletions

View file

@ -76,6 +76,8 @@ enum
COLDRAWFUNC_DROPSHADOW,
COLDRAWFUNC_AFFINE,
COLDRAWFUNC_AFFINETRANS,
COLDRAWFUNC_AFFINEFUZZY,
COLDRAWFUNC_AFFINETRANSTRANS,
COLDRAWFUNC_MAX
};
@ -205,6 +207,8 @@ void R_DrawFogColumn(drawcolumndata_t* dc);
void R_DrawColumnShadowed(drawcolumndata_t* dc);
void R_DrawAffineColumn(drawcolumndata_t* dc);
void R_DrawTranslatedAffineColumn(drawcolumndata_t* dc);
void R_DrawTranslucentAffineColumn(drawcolumndata_t* dc);
void R_DrawTranslatedTranslucentAffineColumn(drawcolumndata_t* dc);
void R_DrawColumn_Brightmap(drawcolumndata_t* dc);
void R_DrawTranslucentColumn_Brightmap(drawcolumndata_t* dc);

View file

@ -681,3 +681,5 @@ static void R_DrawAffineColumnTemplate(drawcolumndata_t *dc)
DEFINE_AFFINE_COLUMN_SETUP(R_DrawAffineColumn, DC_BASIC);
DEFINE_AFFINE_COLUMN_SETUP(R_DrawTranslatedAffineColumn, DC_COLORMAP);
DEFINE_AFFINE_COLUMN_SETUP(R_DrawTranslucentAffineColumn, DC_TRANSMAP);
DEFINE_AFFINE_COLUMN_SETUP(R_DrawTranslatedTranslucentAffineColumn, DC_COLORMAP|DC_TRANSMAP);

View file

@ -1043,9 +1043,26 @@ static void R_DrawVisSprite(vissprite_t *vis)
// Specialized affine drawing functions, primarily for player sprites.
if (dc.translation) // translate green skin to another color
R_SetColumnFunc(COLDRAWFUNC_AFFINETRANS, false);
{
if (vis->transmap)
{
R_SetColumnFunc(COLDRAWFUNC_AFFINETRANSTRANS, false);
dc.transmap = vis->transmap;
}
else
{
R_SetColumnFunc(COLDRAWFUNC_AFFINETRANS, false);
}
}
else if (vis->transmap)
{
R_SetColumnFunc(COLDRAWFUNC_AFFINEFUZZY, false);
dc.transmap = vis->transmap;
}
else
{
R_SetColumnFunc(COLDRAWFUNC_AFFINE, false);
}
}
// Hack: Use a special column function for drop shadows that bypasses
// invalid memory access crashes caused by R_ProjectDropShadow putting wrong values

View file

@ -133,10 +133,13 @@ void SCR_SetDrawFuncs(enum columncontext_e _columncontext)
colfuncs[COLDRAWFUNC_FOG] = R_DrawFogColumn;
colfuncs[COLDRAWFUNC_DROPSHADOW] = R_DrawDropShadowColumn;
// Affine functions
// Affine functions; the ones here are only relevant for sprites.
// We can't rotate texture columns normally, can we?
colfuncs[COLDRAWFUNC_AFFINE] = R_DrawAffineColumn;
colfuncs[COLDRAWFUNC_AFFINETRANS] = R_DrawTranslatedAffineColumn;
colfuncs[COLDRAWFUNC_AFFINEFUZZY] = R_DrawTranslucentAffineColumn;
colfuncs[COLDRAWFUNC_AFFINETRANSTRANS] = R_DrawTranslatedTranslucentAffineColumn;
colfuncs_bm[BASEDRAWFUNC] = R_DrawColumn_Brightmap;
colfuncs_bm[COLDRAWFUNC_FUZZY] = R_DrawTranslucentColumn_Brightmap;
@ -152,6 +155,8 @@ void SCR_SetDrawFuncs(enum columncontext_e _columncontext)
colfuncs_bm[COLDRAWFUNC_AFFINE] = NULL;
colfuncs_bm[COLDRAWFUNC_AFFINETRANS] = NULL;
colfuncs_bm[COLDRAWFUNC_AFFINEFUZZY] = NULL;
colfuncs_bm[COLDRAWFUNC_AFFINETRANSTRANS] = NULL;
spanfuncs[BASEDRAWFUNC] = R_DrawSpan;
spanfuncs[SPANDRAWFUNC_TRANS] = R_DrawTranslucentSpan;