Merge the alpha and transtable functions

This commit is contained in:
Lactozilla 2023-06-25 02:44:05 -03:00
parent edb2cb505e
commit e88fa3f4af
12 changed files with 247 additions and 2412 deletions

View file

@ -112,8 +112,10 @@ static INT32 multtableinv[0x10000];
static INT32 *dp_multtable = NULL;
static INT32 *dp_multtableinv = NULL;
static UINT8 *dp_transmap = NULL;
UINT32 (*R_BlendModeMix)(UINT32, UINT32, UINT8) = NULL;
UINT8 (*R_AlphaBlend)(UINT8, UINT8, UINT8 *) = NULL;
// ----------------------
// translation stuff here
@ -1120,13 +1122,18 @@ static inline void R_SetBlendingFunction(INT32 blendmode)
}
}
static UINT8 R_AlphaBlend_8(UINT8 src, UINT8 alpha, UINT8 *dest)
UINT8 R_AlphaBlend_8(UINT8 src, UINT8 alpha, UINT8 *dest)
{
RGBA_t result;
result.rgba = R_BlendModeMix(GetTrueColor(src), GetTrueColor(*dest), alpha);
return GetColorLUT(&r_draw_lut, result.s.red, result.s.green, result.s.blue);
}
UINT8 R_TransTabBlend_8(UINT8 src, UINT8 alpha, UINT8 *dest)
{
return *(dp_transmap + (src << 8) + (*dest));
}
static UINT8 R_AlphaBlend_s8d8(UINT8 src, UINT8 alpha, UINT8 dest)
{
RGBA_t result;
@ -1149,6 +1156,7 @@ void R_SetColumnBlendingFunction(INT32 blendmode)
dp_multtable = &multtable[dc_alpha << 8];
dp_multtableinv = &multtableinv[dc_alpha << 8];
dp_transmap = dc_transmap;
}
void R_SetSpanBlendingFunction(INT32 blendmode)
@ -1162,6 +1170,7 @@ void R_SetSpanBlendingFunction(INT32 blendmode)
dp_multtable = &multtable[ds_alpha << 8];
dp_multtableinv = &multtableinv[ds_alpha << 8];
dp_transmap = ds_transmap;
}
void R_InitAlphaLUT(void)
@ -1422,18 +1431,14 @@ static inline void R_SetBlendingFunction_ColorMix(INT32 blendmode)
#undef clamp
#define WriteTranslucentColumn(idx) *dest = R_AlphaBlend_8(idx, dc_alpha, dest)
#define WriteTranslucentColumn32(idx) *dest = R_BlendModeMix(idx, dc_alpha, (UINT32 *)dest)
#define WriteTranslucentColumn_s8d32(idx) *dest = R_BlendModeMix(GetTrueColor(idx), *(UINT32 *)dest, dc_alpha)
#define WriteTranslucentColumn_s32d32(idx) *dest = R_BlendModeMix(idx, *(UINT32 *)dest, dc_alpha)
#define WriteTranslucentSpan(idx) *dest = R_AlphaBlend_8(idx, ds_alpha, dest)
#define WriteTranslucentSpan32(idx) *dest = R_BlendModeMix(idx, *(UINT32 *)dest, ds_alpha)
#define WriteTranslucentSpanIdx(idx, destidx) dest[destidx] = R_BlendModeMix(GetTrueColor(idx), dest[destidx], ds_alpha)
#define WriteTranslucentSpanIdx32(idx, destidx) dest[destidx] = R_BlendModeMix(idx, dest[destidx], ds_alpha)
#define WriteTranslucentSpan_s8d32(idx) *dest = R_BlendModeMix(GetTrueColor(idx), *(UINT32 *)dest, ds_alpha)
#define WriteTranslucentSpan_s32d32(idx) *dest = R_BlendModeMix(idx, *(UINT32 *)dest, ds_alpha)
#define WriteTranslucentWaterSpan(idx) *dest = R_AlphaBlend_8(idx, ds_alpha, dsrc); dsrc++
#define WriteTranslucentWaterSpan32(idx) *dest = R_BlendModeMix(idx, *(UINT32 *)dsrc, ds_alpha); dsrc++
#define WriteTranslucentWaterSpanIdx(idx, destidx) dest[destidx] = R_BlendModeMix(GetTrueColor(idx), *(UINT32 *)dsrc, ds_alpha); dsrc++
#define WriteTranslucentWaterSpanIdx32(idx, destidx) dest[destidx] = R_BlendModeMix(idx, *(UINT32 *)dsrc, ds_alpha); dsrc++
#define WriteTranslucentWaterSpan_s8d32(idx) *dest = R_BlendModeMix(GetTrueColor(idx), *(UINT32 *)dsrc, ds_alpha); dsrc++
#define WriteTranslucentWaterSpan_s32d32(idx) *dest = R_BlendModeMix(idx, *(UINT32 *)dsrc, ds_alpha); dsrc++
#include "r_draw32.c"
#include "r_draw32_npo2.c"

View file

@ -186,92 +186,49 @@ void R_DrawViewBorder(void);
#define TRANSPARENTPIXEL 255
#define COLFUNCLIST8(X) \
X(TRANSTAB, Translucent); \
X(ALPHA, Alpha); \
X(TRANSLATED, Translated); \
X(TRANSLUCENT, Translucent); \
X(MAPPED, Translated); \
X(SHADE, Shade); \
X(LIGHTLIST, Shadowed); \
X(MAPPED_TRANSTAB, TranslatedTranslucent); \
X(MAPPED_ALPHA, TranslatedAlpha); \
X(MAPPED_TRANSLUCENT, TranslatedTranslucent); \
X(MULTIPATCH, 2sMultiPatch); \
X(MULTIPATCH_TRANSTAB, 2sMultiPatchTranslucent); \
X(MULTIPATCH_ALPHA, 2sMultiPatchAlpha)
X(MULTIPATCH_TRANSLUCENT, 2sMultiPatchTranslucent)
#define COLFUNCLIST8_NOTEXTURE(X) \
X(FOG, Fog); \
X(DROP_SHADOW, DropShadow)
#define SPANFUNCLIST8(X) \
X(TRANSTAB, TranslucentSpan); \
X(ALPHA, AlphaSpan); \
X(TRANSLUCENT, TranslucentSpan); \
X(TILTED, TiltedSpan); \
X(TILTED_TRANSTAB, TiltedTranslucentSpan); \
X(TILTED_ALPHA, TiltedAlphaSpan); \
X(TILTED_TRANSLUCENT, TiltedTranslucentSpan); \
X(SPLAT, Splat); \
X(SPLAT_TRANSTAB, TranslucentSplat); \
X(SPLAT_ALPHA, AlphaSplat); \
X(SPLAT_TRANSLUCENT, TranslucentSplat); \
X(SPLAT_TILTED, TiltedSplat); \
X(SPRITE, FloorSprite); \
X(SPRITE_TRANSTAB, TranslucentFloorSprite); \
X(SPRITE_ALPHA, AlphaFloorSprite); \
X(SPRITE_TRANSLUCENT, TranslucentFloorSprite); \
X(SPRITE_TILTED, TiltedFloorSprite); \
X(SPRITE_TILTED_TRANSTAB, TiltedTranslucentFloorSprite); \
X(SPRITE_TILTED_ALPHA, TiltedAlphaFloorSprite); \
X(WATER_TRANSTAB, WaterSpan); \
X(WATER_ALPHA, AlphaWaterSpan); \
X(WATER_TILTED_TRANSTAB, TiltedWaterSpan); \
X(WATER_TILTED_ALPHA, TiltedAlphaWaterSpan)
X(SPRITE_TILTED_TRANSLUCENT, TiltedTranslucentFloorSprite); \
X(WATER, WaterSpan); \
X(WATER_TILTED, TiltedWaterSpan); \
#define SPANFUNCLIST8_NOTEXTURE(X) \
X(FOG, FogSpan); \
X(FOG_TILTED, TiltedFogSpan); \
X(SOLIDCOLOR, SolidColorSpan); \
X(SOLIDCOLOR_TILTED, TiltedSolidColorSpan); \
X(SOLIDCOLOR_TRANSTAB, TransSolidColorSpan); \
X(SOLIDCOLOR_ALPHA, AlphaSolidColorSpan); \
X(WATER_SOLIDCOLOR_TRANSTAB, WaterSolidColorSpan); \
X(WATER_SOLIDCOLOR_ALPHA, AlphaWaterSolidColorSpan); \
X(TILTED_SOLIDCOLOR_TRANSTAB, TiltedTransSolidColorSpan); \
X(TILTED_SOLIDCOLOR_ALPHA, TiltedAlphaSolidColorSpan); \
X(WATER_TILTED_SOLIDCOLOR_TRANSTAB, TiltedWaterSolidColorSpan); \
X(WATER_TILTED_SOLIDCOLOR_ALPHA, TiltedAlphaWaterSolidColorSpan)
X(SOLIDCOLOR_TRANSLUCENT, TranslucentSolidColorSpan); \
X(SOLIDCOLOR_TILTED_TRANSLUCENT, TiltedTranslucentSolidColorSpan); \
X(SOLIDCOLOR_WATER, WaterSolidColorSpan); \
X(SOLIDCOLOR_TILTED_WATER, TiltedWaterSolidColorSpan)
#define COLFUNCLIST32(X) \
X(ALPHA, Translucent); \
X(TRANSLATED, Translated); \
X(SHADE, Shade); \
X(LIGHTLIST, Shadowed); \
X(MAPPED_ALPHA, TranslatedTranslucent); \
X(MULTIPATCH, 2sMultiPatch); \
X(MULTIPATCH_ALPHA, 2sMultiPatchTranslucent)
#define COLFUNCLIST32(X) COLFUNCLIST8(X)
#define COLFUNCLIST32_NOTEXTURE(X) \
X(FOG, Fog); \
X(DROP_SHADOW, DropShadow)
#define COLFUNCLIST32_NOTEXTURE(X) COLFUNCLIST8_NOTEXTURE(X)
#define SPANFUNCLIST32(X) \
X(ALPHA, TranslucentSpan); \
X(TILTED, TiltedSpan); \
X(TILTED_ALPHA, TiltedTranslucentSpan); \
X(SPLAT, Splat); \
X(SPLAT_ALPHA, TranslucentSplat); \
X(SPLAT_TILTED, TiltedSplat); \
X(SPRITE, FloorSprite); \
X(SPRITE_ALPHA, TranslucentFloorSprite); \
X(SPRITE_TILTED, TiltedFloorSprite); \
X(SPRITE_TILTED_ALPHA, TiltedTranslucentFloorSprite); \
X(WATER_ALPHA, WaterSpan); \
X(WATER_TILTED_ALPHA, TiltedWaterSpan)
#define SPANFUNCLIST32(X) SPANFUNCLIST8(X)
#define SPANFUNCLIST32_NOTEXTURE(X) \
X(FOG, FogSpan); \
X(FOG_TILTED, TiltedFogSpan); \
X(SOLIDCOLOR, SolidColorSpan); \
X(SOLIDCOLOR_TILTED, TiltedSolidColorSpan); \
X(SOLIDCOLOR_ALPHA, TranslucentSolidColorSpan); \
X(WATER_SOLIDCOLOR_ALPHA, WaterSolidColorSpan); \
X(TILTED_SOLIDCOLOR_ALPHA, TiltedTranslucentSolidColorSpan); \
X(WATER_TILTED_SOLIDCOLOR_ALPHA, TiltedWaterSolidColorSpan)
#define SPANFUNCLIST32_NOTEXTURE(X) SPANFUNCLIST8_NOTEXTURE(X)
// -----------------
// 8bpp DRAWING CODE
@ -363,6 +320,11 @@ void R_DrawSpan_NPO2_32(void);
|( ( (R_GetRgbaA(bg) * MIX_ALPHA(alpha)) + (R_GetRgbaA(fg) * (alpha)) ) >> 8) << 24)
extern UINT32 (*R_BlendModeMix)(UINT32, UINT32, UINT8);
extern UINT8 (*R_AlphaBlend)(UINT8, UINT8, UINT8 *);
UINT8 R_AlphaBlend_8(UINT8 src, UINT8 alpha, UINT8 *dest);
UINT8 R_TransTabBlend_8(UINT8 src, UINT8 alpha, UINT8 *dest);
void R_SetColumnBlendingFunction(INT32 blendmode);
void R_SetSpanBlendingFunction(INT32 blendmode);
void R_InitAlphaLUT(void);

File diff suppressed because it is too large Load diff

View file

@ -624,7 +624,7 @@ void R_DrawTiltedTranslucentSpan_NPO2_32(void)
else
y -= libdivide_u32_do((UINT32)y, &y_divider) * ds_flatheight;
WriteTranslucentSpan(colormap[source[((y * ds_flatwidth) + x)]]);
WriteTranslucentSpan_s8d32(colormap[source[((y * ds_flatwidth) + x)]]);
}
dest++;
u += stepu;
@ -656,7 +656,7 @@ void R_DrawTiltedTranslucentSpan_NPO2_32(void)
else
y -= libdivide_u32_do((UINT32)y, &y_divider) * ds_flatheight;
WriteTranslucentSpan(colormap[source[((y * ds_flatwidth) + x)]]);
WriteTranslucentSpan_s8d32(colormap[source[((y * ds_flatwidth) + x)]]);
}
}
else
@ -693,7 +693,7 @@ void R_DrawTiltedTranslucentSpan_NPO2_32(void)
else
y -= libdivide_u32_do((UINT32)y, &y_divider) * ds_flatheight;
WriteTranslucentSpan(colormap[source[((y * ds_flatwidth) + x)]]);
WriteTranslucentSpan_s8d32(colormap[source[((y * ds_flatwidth) + x)]]);
}
dest++;
u += stepu;
@ -736,7 +736,7 @@ void R_DrawTiltedTranslucentSpan_NPO2_32(void)
else
y -= libdivide_u32_do((UINT32)y, &y_divider) * ds_flatheight;
WriteTranslucentSpan32(colormapu32[source[((y * ds_flatwidth) + x)]]);
WriteTranslucentSpan_s32d32(colormapu32[source[((y * ds_flatwidth) + x)]]);
}
dest++;
u += stepu;
@ -768,7 +768,7 @@ void R_DrawTiltedTranslucentSpan_NPO2_32(void)
else
y -= libdivide_u32_do((UINT32)y, &y_divider) * ds_flatheight;
WriteTranslucentSpan32(colormapu32[source[((y * ds_flatwidth) + x)]]);
WriteTranslucentSpan_s32d32(colormapu32[source[((y * ds_flatwidth) + x)]]);
}
}
else
@ -805,7 +805,7 @@ void R_DrawTiltedTranslucentSpan_NPO2_32(void)
else
y -= libdivide_u32_do((UINT32)y, &y_divider) * ds_flatheight;
WriteTranslucentSpan32(colormapu32[source[((y * ds_flatwidth) + x)]]);
WriteTranslucentSpan_s32d32(colormapu32[source[((y * ds_flatwidth) + x)]]);
}
dest++;
u += stepu;
@ -1013,7 +1013,7 @@ void R_DrawTiltedWaterSpan_NPO2_32(void)
else
y -= libdivide_u32_do((UINT32)y, &y_divider) * ds_flatheight;
WriteTranslucentWaterSpan(colormapu32[source[((y * ds_flatwidth) + x)]]);
WriteTranslucentWaterSpan_s8d32(colormapu32[source[((y * ds_flatwidth) + x)]]);
}
dest++;
u += stepu;
@ -1045,7 +1045,7 @@ void R_DrawTiltedWaterSpan_NPO2_32(void)
else
y -= libdivide_u32_do((UINT32)y, &y_divider) * ds_flatheight;
WriteTranslucentWaterSpan(colormap[source[((y * ds_flatwidth) + x)]]);
WriteTranslucentWaterSpan_s8d32(colormap[source[((y * ds_flatwidth) + x)]]);
}
}
else
@ -1082,7 +1082,7 @@ void R_DrawTiltedWaterSpan_NPO2_32(void)
else
y -= libdivide_u32_do((UINT32)y, &y_divider) * ds_flatheight;
WriteTranslucentWaterSpan(colormap[source[((y * ds_flatwidth) + x)]]);
WriteTranslucentWaterSpan_s8d32(colormap[source[((y * ds_flatwidth) + x)]]);
}
dest++;
u += stepu;
@ -1125,7 +1125,7 @@ void R_DrawTiltedWaterSpan_NPO2_32(void)
else
y -= libdivide_u32_do((UINT32)y, &y_divider) * ds_flatheight;
WriteTranslucentWaterSpan32(colormapu32[source[((y * ds_flatwidth) + x)]]);
WriteTranslucentWaterSpan_s32d32(colormapu32[source[((y * ds_flatwidth) + x)]]);
}
dest++;
u += stepu;
@ -1157,7 +1157,7 @@ void R_DrawTiltedWaterSpan_NPO2_32(void)
else
y -= libdivide_u32_do((UINT32)y, &y_divider) * ds_flatheight;
WriteTranslucentWaterSpan32(colormapu32[source[((y * ds_flatwidth) + x)]]);
WriteTranslucentWaterSpan_s32d32(colormapu32[source[((y * ds_flatwidth) + x)]]);
}
}
else
@ -1194,7 +1194,7 @@ void R_DrawTiltedWaterSpan_NPO2_32(void)
else
y -= libdivide_u32_do((UINT32)y, &y_divider) * ds_flatheight;
WriteTranslucentWaterSpan32(colormapu32[source[((y * ds_flatwidth) + x)]]);
WriteTranslucentWaterSpan_s32d32(colormapu32[source[((y * ds_flatwidth) + x)]]);
}
dest++;
u += stepu;
@ -1946,7 +1946,7 @@ void R_DrawTranslucentSplat_NPO2_32(void)
val = source[((y * ds_flatwidth) + x)];
if (val != TRANSPARENTPIXEL)
WriteTranslucentSpan(colormap[val]);
WriteTranslucentSpan_s8d32(colormap[val]);
dest++;
xposition += xstep;
yposition += ystep;
@ -1977,7 +1977,7 @@ void R_DrawTranslucentSplat_NPO2_32(void)
val = source[((y * ds_flatwidth) + x)];
if (val != TRANSPARENTPIXEL)
WriteTranslucentSpan32(colormapu32[val]);
WriteTranslucentSpan_s32d32(colormapu32[val]);
dest++;
xposition += xstep;
yposition += ystep;
@ -2244,7 +2244,7 @@ void R_DrawTranslucentFloorSprite_NPO2_32(void)
val = source[((y * ds_flatwidth) + x)];
if (val & 0xFF00)
WriteTranslucentSpan(colormap[translation[val & 0xFF]]);
WriteTranslucentSpan_s8d32(colormap[translation[val & 0xFF]]);
dest++;
xposition += xstep;
yposition += ystep;
@ -2277,7 +2277,7 @@ void R_DrawTranslucentFloorSprite_NPO2_32(void)
if (val & 0xFF00)
{
val = colormapu32[translation[val & 0xFF]];
WriteTranslucentSpan32(val);
WriteTranslucentSpan_s32d32(val);
}
dest++;
xposition += xstep;
@ -2801,7 +2801,7 @@ void R_DrawTiltedTranslucentFloorSprite_NPO2_32(void)
val = source[((y * ds_flatwidth) + x)];
if (val & 0xFF00)
WriteTranslucentSpan(colormap[translation[val & 0xFF]]);
WriteTranslucentSpan_s8d32(colormap[translation[val & 0xFF]]);
dest++;
u += stepu;
v += stepv;
@ -2833,7 +2833,7 @@ void R_DrawTiltedTranslucentFloorSprite_NPO2_32(void)
val = source[((y * ds_flatwidth) + x)];
if (val & 0xFF00)
WriteTranslucentSpan(colormap[translation[val & 0xFF]]);
WriteTranslucentSpan_s8d32(colormap[translation[val & 0xFF]]);
}
}
else
@ -2870,7 +2870,7 @@ void R_DrawTiltedTranslucentFloorSprite_NPO2_32(void)
val = source[((y * ds_flatwidth) + x)];
if (val & 0xFF00)
WriteTranslucentSpan(colormap[translation[val & 0xFF]]);
WriteTranslucentSpan_s8d32(colormap[translation[val & 0xFF]]);
dest++;
u += stepu;
v += stepv;
@ -2913,7 +2913,7 @@ void R_DrawTiltedTranslucentFloorSprite_NPO2_32(void)
val = source[((y * ds_flatwidth) + x)];
if (val & 0xFF00)
WriteTranslucentSpan32(colormapu32[translation[val & 0xFF]]);
WriteTranslucentSpan_s32d32(colormapu32[translation[val & 0xFF]]);
}
dest++;
u += stepu;
@ -2946,7 +2946,7 @@ void R_DrawTiltedTranslucentFloorSprite_NPO2_32(void)
val = source[((y * ds_flatwidth) + x)];
if (val & 0xFF00)
WriteTranslucentSpan32(colormapu32[translation[val & 0xFF]]);
WriteTranslucentSpan_s32d32(colormapu32[translation[val & 0xFF]]);
}
}
else
@ -2985,7 +2985,7 @@ void R_DrawTiltedTranslucentFloorSprite_NPO2_32(void)
val = source[((y * ds_flatwidth) + x)];
if (val & 0xFF00)
WriteTranslucentSpan32(colormapu32[translation[val & 0xFF]]);
WriteTranslucentSpan_s32d32(colormapu32[translation[val & 0xFF]]);
}
dest++;
u += stepu;
@ -3183,7 +3183,7 @@ void R_DrawTranslucentSpan_NPO2_32(void)
y = (yposition >> FRACBITS);
val = colormap[source[((y * ds_flatwidth) + x)]];
WriteTranslucentSpan(val);
WriteTranslucentSpan_s8d32(val);
dest++;
xposition += xstep;
yposition += ystep;
@ -3213,7 +3213,7 @@ void R_DrawTranslucentSpan_NPO2_32(void)
y = (yposition >> FRACBITS);
val = colormapu32[source[((y * ds_flatwidth) + x)]];
WriteTranslucentSpan32(val);
WriteTranslucentSpan_s32d32(val);
dest++;
xposition += xstep;
yposition += ystep;
@ -3324,7 +3324,7 @@ void R_DrawWaterSpan_NPO2_32(void)
x = (xposition >> FRACBITS);
y = (yposition >> FRACBITS);
WriteTranslucentWaterSpan(colormap[source[((y * ds_flatwidth) + x)]]);
WriteTranslucentWaterSpan_s8d32(colormap[source[((y * ds_flatwidth) + x)]]);
dest++;
xposition += xstep;
yposition += ystep;
@ -3353,7 +3353,7 @@ void R_DrawWaterSpan_NPO2_32(void)
x = (xposition >> FRACBITS);
y = (yposition >> FRACBITS);
WriteTranslucentWaterSpan32(colormapu32[source[((y * ds_flatwidth) + x)]]);
WriteTranslucentWaterSpan_s32d32(colormapu32[source[((y * ds_flatwidth) + x)]]);
dest++;
xposition += xstep;
yposition += ystep;

File diff suppressed because it is too large Load diff

View file

@ -343,7 +343,8 @@ void R_DrawTiltedTranslucentSpan_NPO2_8(void)
else
y -= libdivide_u32_do((UINT32)y, &y_divider) * ds_flatheight;
*dest = *(ds_transmap + (colormap[source[((y * ds_flatwidth) + x)]] << 8) + *dest);
// *dest = *(ds_transmap + (colormap[source[((y * ds_flatwidth) + x)]] << 8) + *dest);
// TODO
}
dest++;
u += stepu;
@ -375,7 +376,8 @@ void R_DrawTiltedTranslucentSpan_NPO2_8(void)
else
y -= libdivide_u32_do((UINT32)y, &y_divider) * ds_flatheight;
*dest = *(ds_transmap + (colormap[source[((y * ds_flatwidth) + x)]] << 8) + *dest);
// *dest = *(ds_transmap + (colormap[source[((y * ds_flatwidth) + x)]] << 8) + *dest);
// TODO
}
}
else
@ -412,7 +414,8 @@ void R_DrawTiltedTranslucentSpan_NPO2_8(void)
else
y -= libdivide_u32_do((UINT32)y, &y_divider) * ds_flatheight;
*dest = *(ds_transmap + (colormap[source[((y * ds_flatwidth) + x)]] << 8) + *dest);
// *dest = *(ds_transmap + (colormap[source[((y * ds_flatwidth) + x)]] << 8) + *dest);
// TODO
}
dest++;
u += stepu;
@ -422,11 +425,6 @@ void R_DrawTiltedTranslucentSpan_NPO2_8(void)
}
}
void R_DrawTiltedAlphaSpan_NPO2_8(void)
{
// TODO
}
void R_DrawTiltedSplat_NPO2_8(void)
{
// x1, x2 = ds_x1, ds_x2
@ -713,18 +711,16 @@ void R_DrawTranslucentSplat_NPO2_8(void)
y = (yposition >> FRACBITS);
val = source[((y * ds_flatwidth) + x)];
if (val != TRANSPARENTPIXEL)
*dest = *(ds_transmap + (colormap[val] << 8) + *dest);
{
// TODO
// *dest = *(ds_transmap + (colormap[val] << 8) + *dest);
}
dest++;
xposition += xstep;
yposition += ystep;
}
}
void R_DrawAlphaSplat_NPO2_8(void)
{
// TODO
}
/** \brief The R_DrawFloorSprite_NPO2_8 function
Just like R_DrawSplat_NPO2_8, but for floor sprites.
*/
@ -858,18 +854,16 @@ void R_DrawTranslucentFloorSprite_NPO2_8(void)
y = (yposition >> FRACBITS);
val = source[((y * ds_flatwidth) + x)];
if (val & 0xFF00)
*dest = *(ds_transmap + (colormap[translation[val & 0xFF]] << 8) + *dest);
{
// TODO
// *dest = *(ds_transmap + (colormap[translation[val & 0xFF]] << 8) + *dest);
}
dest++;
xposition += xstep;
yposition += ystep;
}
}
void R_DrawAlphaFloorSprite_NPO2_8(void)
{
// TODO
}
/** \brief The R_DrawTiltedFloorSprite_NPO2_8 function
Draws a tilted floor sprite.
*/
@ -1100,7 +1094,10 @@ void R_DrawTiltedTranslucentFloorSprite_NPO2_8(void)
val = source[((y * ds_flatwidth) + x)];
if (val & 0xFF00)
*dest = *(ds_transmap + (colormap[translation[val & 0xFF]] << 8) + *dest);
{
// TODO
// *dest = *(ds_transmap + (colormap[translation[val & 0xFF]] << 8) + *dest);
}
dest++;
u += stepu;
@ -1133,7 +1130,10 @@ void R_DrawTiltedTranslucentFloorSprite_NPO2_8(void)
val = source[((y * ds_flatwidth) + x)];
if (val & 0xFF00)
*dest = *(ds_transmap + (colormap[translation[val & 0xFF]] << 8) + *dest);
{
// TODO
// *dest = *(ds_transmap + (colormap[translation[val & 0xFF]] << 8) + *dest);
}
}
}
else
@ -1170,7 +1170,10 @@ void R_DrawTiltedTranslucentFloorSprite_NPO2_8(void)
val = source[((y * ds_flatwidth) + x)];
if (val & 0xFF00)
*dest = *(ds_transmap + (colormap[translation[val & 0xFF]] << 8) + *dest);
{
// TODO
// *dest = *(ds_transmap + (colormap[translation[val & 0xFF]] << 8) + *dest);
}
dest++;
u += stepu;
@ -1180,11 +1183,6 @@ void R_DrawTiltedTranslucentFloorSprite_NPO2_8(void)
}
}
void R_DrawTiltedAlphaFloorSprite_NPO2_8(void)
{
// TODO
}
/** \brief The R_DrawTranslucentSpan_NPO2_8 function
Draws the actual span with translucency.
*/
@ -1245,18 +1243,14 @@ void R_DrawTranslucentSpan_NPO2_8(void)
x = (xposition >> FRACBITS);
y = (yposition >> FRACBITS);
val = ((y * ds_flatwidth) + x);
*dest = *(ds_transmap + (colormap[source[val]] << 8) + *dest);
// TODO
// *dest = *(ds_transmap + (colormap[source[val]] << 8) + *dest);
dest++;
xposition += xstep;
yposition += ystep;
}
}
void R_DrawAlphaSpan_NPO2_8(void)
{
// TODO
}
void R_DrawWaterSpan_NPO2_8(void)
{
fixed_t xposition;
@ -1314,17 +1308,13 @@ void R_DrawWaterSpan_NPO2_8(void)
x = (xposition >> FRACBITS);
y = (yposition >> FRACBITS);
*dest++ = colormap[*(ds_transmap + (source[((y * ds_flatwidth) + x)] << 8) + *dsrc++)];
// TODO
// *dest++ = colormap[*(ds_transmap + (source[((y * ds_flatwidth) + x)] << 8) + *dsrc++)];
xposition += xstep;
yposition += ystep;
}
}
void R_DrawAlphaWaterSpan_NPO2_8(void)
{
// TODO
}
/** \brief The R_DrawTiltedWaterSpan_NPO2_8 function
Like DrawTiltedTranslucentSpan_NPO2, but for water
*/
@ -1400,7 +1390,8 @@ void R_DrawTiltedWaterSpan_NPO2_8(void)
else
y -= libdivide_u32_do((UINT32)y, &y_divider) * ds_flatheight;
*dest = *(ds_transmap + (colormap[source[((y * ds_flatwidth) + x)]] << 8) + *dsrc++);
// TODO
// *dest = *(ds_transmap + (colormap[source[((y * ds_flatwidth) + x)]] << 8) + *dsrc++);
}
dest++;
u += stepu;
@ -1432,7 +1423,8 @@ void R_DrawTiltedWaterSpan_NPO2_8(void)
else
y -= libdivide_u32_do((UINT32)y, &y_divider) * ds_flatheight;
*dest = *(ds_transmap + (colormap[source[((y * ds_flatwidth) + x)]] << 8) + *dsrc++);
// TODO
// *dest = *(ds_transmap + (colormap[source[((y * ds_flatwidth) + x)]] << 8) + *dsrc++);
}
}
else
@ -1469,7 +1461,8 @@ void R_DrawTiltedWaterSpan_NPO2_8(void)
else
y -= libdivide_u32_do((UINT32)y, &y_divider) * ds_flatheight;
*dest = *(ds_transmap + (colormap[source[((y * ds_flatwidth) + x)]] << 8) + *dsrc++);
// TODO
// *dest = *(ds_transmap + (colormap[source[((y * ds_flatwidth) + x)]] << 8) + *dsrc++);
}
dest++;
u += stepu;
@ -1478,8 +1471,3 @@ void R_DrawTiltedWaterSpan_NPO2_8(void)
}
}
}
void R_DrawTiltedAlphaWaterSpan_NPO2_8(void)
{
// TODO
}

View file

@ -951,7 +951,7 @@ void R_DrawSinglePlane(visplane_t *pl)
else
ds_transmap = R_GetTranslucencyTable(transval);
spanfunctype = (pl->polyobj->flags & POF_SPLAT) ? span_translu_splat : span_translu_splat;
spanfunctype = (pl->polyobj->flags & POF_SPLAT) ? SPAN_SPLAT_TRANSLUCENT : SPAN_TRANSLUCENT;
}
else if (pl->polyobj->flags & POF_SPLAT) // Opaque, but allow transparent flat pixels
{
@ -995,7 +995,7 @@ void R_DrawSinglePlane(visplane_t *pl)
INT32 blendmode = pl->ffloor->blend ? pl->ffloor->blend : AST_TRANSLUCENT;
boolean splat = false;
spanfunctype = (pl->ffloor->fofflags & FOF_SPLAT) ? span_translu_splat : span_translu;
spanfunctype = (pl->ffloor->fofflags & FOF_SPLAT) ? SPAN_SPLAT_TRANSLUCENT : SPAN_TRANSLUCENT;
if (!usetranstables)
{
@ -1050,7 +1050,7 @@ void R_DrawSinglePlane(visplane_t *pl)
{
planeripple.active = true;
if (spanfunctype == span_translu)
if (spanfunctype == SPAN_TRANSLUCENT)
{
// Copy the current scene, ugh
INT32 top = pl->high-8;
@ -1061,7 +1061,7 @@ void R_DrawSinglePlane(visplane_t *pl)
if (bottom > vid.height)
bottom = vid.height;
spanfunctype = span_water;
spanfunctype = SPAN_WATER;
// Only copy the part of the screen we need
VID_BlitLinearScreen((splitscreen && viewplayer == &players[secondarydisplayplayer]) ? screens[0] + (top+(vid.height>>1))*vid.rowbytes : screens[0]+((top)*vid.rowbytes), screens[1]+((top)*vid.rowbytes),
@ -1133,10 +1133,10 @@ void R_DrawSinglePlane(visplane_t *pl)
if (ds_solidcolor)
{
// NOTE: can't possibly have fog and solid color at the same time
if (spanfunctype == span_water)
spanfunctype = span_water_solidcolor;
else if (spanfunctype == span_translu)
spanfunctype = span_translu_solidcolor;
if (spanfunctype == SPAN_WATER)
spanfunctype = SPAN_SOLIDCOLOR_WATER;
else if (spanfunctype == SPAN_TRANSLUCENT)
spanfunctype = SPAN_SOLIDCOLOR_TRANSLUCENT;
else
spanfunctype = SPAN_SOLIDCOLOR;
}
@ -1184,14 +1184,14 @@ void R_DrawSinglePlane(visplane_t *pl)
else
R_SetSlopePlaneVectors(pl, 0, xoffs, yoffs);
if (spanfunctype == span_water)
spanfunctype = span_water_tilted;
else if (spanfunctype == span_water_solidcolor)
spanfunctype = span_water_tilted_solidcolor;
else if (spanfunctype == span_translu)
spanfunctype = span_translu_tilted;
else if (spanfunctype == span_translu_solidcolor)
spanfunctype = span_translu_tilted_solidcolor;
if (spanfunctype == SPAN_WATER)
spanfunctype = SPAN_WATER_TILTED;
else if (spanfunctype == SPAN_SOLIDCOLOR_WATER)
spanfunctype = SPAN_SOLIDCOLOR_TILTED_WATER;
else if (spanfunctype == SPAN_TRANSLUCENT)
spanfunctype = SPAN_TILTED_TRANSLUCENT;
else if (spanfunctype == SPAN_SOLIDCOLOR_TRANSLUCENT)
spanfunctype = SPAN_SOLIDCOLOR_TILTED_TRANSLUCENT;
else if (spanfunctype == SPAN_SOLIDCOLOR)
spanfunctype = SPAN_SOLIDCOLOR_TILTED;
else if (spanfunctype == SPAN_SPLAT)

View file

@ -120,8 +120,8 @@ static void R_Render2sidedMultiPatchColumn(column_t *column)
if (colfunc == colfuncs[BASEDRAWFUNC])
(colfuncs[COLUMN_MULTIPATCH])();
else if (colfunc == colfuncs[column_translu])
(colfuncs[column_translu_multipatch])();
else if (colfunc == colfuncs[COLUMN_TRANSLUCENT])
(colfuncs[COLUMN_MULTIPATCH_TRANSLUCENT])();
else
colfunc();
}
@ -207,7 +207,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
}
if (translucent)
colfunc = colfuncs[column_translu];
colfunc = colfuncs[COLUMN_TRANSLUCENT];
}
if (curline->polyseg && curline->polyseg->translucency > 0)
@ -238,7 +238,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
}
if (translucent)
colfunc = colfuncs[column_translu];
colfunc = colfuncs[COLUMN_TRANSLUCENT];
}
#ifdef TRUECOLOR
@ -303,7 +303,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
rlight->extra_colormap = *light->extra_colormap;
rlight->flags = light->flags;
if ((colfunc != colfuncs[column_translu])
if ((colfunc != colfuncs[COLUMN_TRANSLUCENT])
|| (rlight->flags & FOF_FOG)
|| (rlight->extra_colormap && (rlight->extra_colormap->flags & CMF_FOG)))
lightnum = (rlight->lightlevel >> LIGHTSEGSHIFT);
@ -322,7 +322,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
}
else
{
if ((colfunc != colfuncs[column_translu])
if ((colfunc != colfuncs[COLUMN_TRANSLUCENT])
|| (frontsector->extra_colormap && (frontsector->extra_colormap->flags & CMF_FOG)))
lightnum = (frontsector->lightlevel >> LIGHTSEGSHIFT);
else
@ -768,7 +768,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
}
if (translucent)
colfunc = colfuncs[column_translu];
colfunc = colfuncs[COLUMN_TRANSLUCENT];
}
else if (pfloor->fofflags & FOF_FOG)
colfunc = colfuncs[COLUMN_FOG];
@ -886,7 +886,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
lightnum = (frontsector->lightlevel >> LIGHTSEGSHIFT);
else if (pfloor->fofflags & FOF_FOG)
lightnum = (pfloor->master->frontsector->lightlevel >> LIGHTSEGSHIFT);
else if (colfunc == colfuncs[column_translu])
else if (colfunc == colfuncs[COLUMN_TRANSLUCENT])
lightnum = LIGHTLEVELS-1;
else
lightnum = R_FakeFlat(frontsector, &tempsec, &templight, &templight, false)

View file

@ -511,9 +511,9 @@ static void R_RasterizeFloorSplat(floorsplat_t *pSplat, vector2_t *verts, visspr
if (translucent)
{
if (pSplat->slope)
spanfunctype = span_translu_sprite_tilted;
spanfunctype = SPAN_SPRITE_TILTED_TRANSLUCENT;
else
spanfunctype = span_translu_sprite;
spanfunctype = SPAN_SPRITE_TRANSLUCENT;
}
if (ds_powersoftwo)

View file

@ -851,13 +851,13 @@ static void R_DrawVisSprite(vissprite_t *vis)
dc_translation = R_GetSpriteTranslation(vis);
if (R_SpriteIsFlashing(vis)) // Bosses "flash"
colfunc = colfuncs[COLUMN_TRANSLATED]; // translate certain pixels to white
colfunc = colfuncs[COLUMN_MAPPED]; // translate certain pixels to white
else if (vis->flags & VIS_TRANSLUCENT)
colfunc = colfuncs[vis->color ? column_translu_mapped : column_translu];
colfunc = colfuncs[vis->color ? COLUMN_MAPPED_TRANSLUCENT : COLUMN_TRANSLUCENT];
else if (vis->color) // translate green skin to another color
colfunc = colfuncs[COLUMN_TRANSLATED];
colfunc = colfuncs[COLUMN_MAPPED];
else if (vis->mobj->sprite == SPR_PLAY) // Looks like a player, but doesn't have a color? Get rid of green sonic syndrome.
colfunc = colfuncs[COLUMN_TRANSLATED];
colfunc = colfuncs[COLUMN_MAPPED];
else
colfunc = colfuncs[BASEDRAWFUNC];
@ -1071,7 +1071,7 @@ static void R_DrawPrecipitationVisSprite(vissprite_t *vis)
if (vis->flags & VIS_TRANSLUCENT)
{
colfunc = colfuncs[column_translu];
colfunc = colfuncs[COLUMN_TRANSLUCENT];
if (!usetranstables)
{

View file

@ -54,26 +54,10 @@
void (*colfunc)(void);
void (*colfuncs[COLUMN_MAX])(void);
INT32 column_translu;
INT32 column_translu_mapped;
INT32 column_translu_multipatch;
void (*spanfunc)(void);
void (*spanfuncs[SPAN_MAX])(void);
void (*spanfuncs_npo2[SPAN_MAX])(void);
INT32 span_translu;
INT32 span_translu_tilted;
INT32 span_translu_splat;
INT32 span_translu_solidcolor;
INT32 span_translu_tilted_solidcolor;
INT32 span_translu_sprite;
INT32 span_translu_sprite_tilted;
INT32 span_water;
INT32 span_water_tilted;
INT32 span_water_solidcolor;
INT32 span_water_tilted_solidcolor;
// ------------------
// global video state
// ------------------
@ -205,41 +189,9 @@ void SCR_SetSoftwareTranslucency(void)
usetranstables = cv_transtables.value;
if (usetranstables)
{
column_translu = COLUMN_TRANSTAB;
column_translu_mapped = COLUMN_MAPPED_TRANSTAB;
column_translu_multipatch = COLUMN_MULTIPATCH_TRANSTAB;
span_translu = SPAN_TRANSTAB;
span_translu_tilted = SPAN_TILTED_TRANSTAB;
span_translu_splat = SPAN_SPLAT_TRANSTAB;
span_translu_solidcolor = SPAN_SOLIDCOLOR_TRANSTAB;
span_translu_tilted_solidcolor = SPAN_TILTED_SOLIDCOLOR_TRANSTAB;
span_translu_sprite = SPAN_SPRITE_TRANSTAB;
span_translu_sprite_tilted = SPAN_SPRITE_TILTED_TRANSTAB;
span_water = SPAN_WATER_TRANSTAB;
span_water_tilted = SPAN_WATER_TILTED_TRANSTAB;
span_water_solidcolor = SPAN_WATER_SOLIDCOLOR_TRANSTAB;
span_water_tilted_solidcolor = SPAN_WATER_TILTED_SOLIDCOLOR_TRANSTAB;
}
R_AlphaBlend = R_TransTabBlend_8;
else
{
column_translu = COLUMN_ALPHA;
column_translu_mapped = COLUMN_MAPPED_ALPHA;
column_translu_multipatch = COLUMN_MULTIPATCH_ALPHA;
span_translu = SPAN_ALPHA;
span_translu_tilted = SPAN_TILTED_ALPHA;
span_translu_splat = SPAN_SPLAT_ALPHA;
span_translu_solidcolor = SPAN_SOLIDCOLOR_ALPHA;
span_translu_tilted_solidcolor = SPAN_TILTED_SOLIDCOLOR_ALPHA;
span_translu_sprite = SPAN_SPRITE_ALPHA;
span_translu_sprite_tilted = SPAN_SPRITE_TILTED_ALPHA;
span_water = SPAN_WATER_ALPHA;
span_water_tilted = SPAN_WATER_TILTED_ALPHA;
span_water_solidcolor = SPAN_WATER_SOLIDCOLOR_ALPHA;
span_water_tilted_solidcolor = SPAN_WATER_TILTED_SOLIDCOLOR_ALPHA;
}
R_AlphaBlend = R_AlphaBlend_8;
}
void SCR_SetMode(void)

View file

@ -121,14 +121,16 @@ extern vmode_t specialmodes[NUMSPECIALMODES];
enum
{
COLUMN_BASE = BASEDRAWFUNC,
COLUMN_TRANSTAB, COLUMN_ALPHA,
COLUMN_TRANSLATED,
COLUMN_MAPPED,
COLUMN_TRANSLUCENT,
COLUMN_MAPPED_TRANSLUCENT,
COLUMN_MULTIPATCH,
COLUMN_MULTIPATCH_TRANSLUCENT,
COLUMN_FOG,
COLUMN_SHADE,
COLUMN_LIGHTLIST,
COLUMN_MAPPED_TRANSTAB, COLUMN_MAPPED_ALPHA,
COLUMN_MULTIPATCH,
COLUMN_MULTIPATCH_TRANSTAB, COLUMN_MULTIPATCH_ALPHA,
COLUMN_FOG,
COLUMN_DROP_SHADOW,
COLUMN_MAX
@ -137,62 +139,43 @@ enum
extern void (*colfunc)(void);
extern void (*colfuncs[COLUMN_MAX])(void);
extern INT32 column_translu;
extern INT32 column_translu_mapped;
extern INT32 column_translu_multipatch;
enum
{
SPAN_BASE = BASEDRAWFUNC,
SPAN_TRANSTAB, SPAN_ALPHA,
SPAN_TRANSLUCENT,
SPAN_TILTED,
SPAN_TILTED_TRANSTAB, SPAN_TILTED_ALPHA,
SPAN_TILTED_TRANSLUCENT,
SPAN_SPLAT,
SPAN_SPLAT_TRANSTAB, SPAN_SPLAT_ALPHA,
SPAN_SPLAT_TRANSLUCENT,
SPAN_SPLAT_TILTED,
SPAN_SPRITE,
SPAN_SPRITE_TRANSTAB, SPAN_SPRITE_ALPHA,
SPAN_SPRITE_TRANSLUCENT,
SPAN_SPRITE_TILTED,
SPAN_SPRITE_TILTED_TRANSTAB, SPAN_SPRITE_TILTED_ALPHA,
SPAN_SPRITE_TILTED_TRANSLUCENT,
SPAN_WATER_TRANSTAB, SPAN_WATER_ALPHA,
SPAN_WATER_TILTED_TRANSTAB, SPAN_WATER_TILTED_ALPHA,
SPAN_WATER,
SPAN_WATER_TILTED,
SPAN_FOG,
SPAN_FOG_TILTED,
SPAN_SOLIDCOLOR,
SPAN_SOLIDCOLOR_TILTED,
SPAN_SOLIDCOLOR_TRANSTAB, SPAN_SOLIDCOLOR_ALPHA,
SPAN_WATER_SOLIDCOLOR_TRANSTAB, SPAN_WATER_SOLIDCOLOR_ALPHA,
SPAN_TILTED_SOLIDCOLOR_TRANSTAB, SPAN_TILTED_SOLIDCOLOR_ALPHA,
SPAN_WATER_TILTED_SOLIDCOLOR_TRANSTAB, SPAN_WATER_TILTED_SOLIDCOLOR_ALPHA,
SPAN_SOLIDCOLOR_TRANSLUCENT,
SPAN_SOLIDCOLOR_TILTED_TRANSLUCENT,
SPAN_SOLIDCOLOR_WATER,
SPAN_SOLIDCOLOR_TILTED_WATER,
SPAN_MAX
};
extern INT32 column_translu;
extern INT32 column_translu_mapped;
extern INT32 column_translu_multipatch;
extern void (*spanfunc)(void);
extern void (*spanfuncs[SPAN_MAX])(void);
extern void (*spanfuncs_npo2[SPAN_MAX])(void);
extern INT32 span_translu;
extern INT32 span_translu_tilted;
extern INT32 span_translu_splat;
extern INT32 span_translu_solidcolor;
extern INT32 span_translu_tilted_solidcolor;
extern INT32 span_translu_sprite;
extern INT32 span_translu_sprite_tilted;
extern INT32 span_water;
extern INT32 span_water_tilted;
extern INT32 span_water_solidcolor;
extern INT32 span_water_tilted_solidcolor;
// -----
// CPUID
// -----