diff --git a/src/r_draw.c b/src/r_draw.c index 4b2c782166b89341182b53daefe9cfa5931e25cc..9091a09f2282f42b53933cc2fa25e9d3edd53515 100644 --- a/src/r_draw.c +++ b/src/r_draw.c @@ -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" diff --git a/src/r_draw.h b/src/r_draw.h index 871babb666ac28188e3ea6f3ab8c962f7d7ee423..5d83783a2dd81d2ef3a17b1cbdaf6f1c7596ae68 100644 --- a/src/r_draw.h +++ b/src/r_draw.h @@ -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) - -#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) + X(SOLIDCOLOR_TRANSLUCENT, TranslucentSolidColorSpan); \ + X(SOLIDCOLOR_TILTED_TRANSLUCENT, TiltedTranslucentSolidColorSpan); \ + X(SOLIDCOLOR_WATER, WaterSolidColorSpan); \ + X(SOLIDCOLOR_TILTED_WATER, TiltedWaterSolidColorSpan) -#define COLFUNCLIST32_NOTEXTURE(X) \ - X(FOG, Fog); \ - X(DROP_SHADOW, DropShadow) +#define COLFUNCLIST32(X) COLFUNCLIST8(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 COLFUNCLIST32_NOTEXTURE(X) COLFUNCLIST8_NOTEXTURE(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(X) SPANFUNCLIST8(X) + +#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); diff --git a/src/r_draw32.c b/src/r_draw32.c index c1b190cfba00de7f4485d216d142fd442c74660a..d4f031bc3f168e624ef65417b6ff217732f06d87 100644 --- a/src/r_draw32.c +++ b/src/r_draw32.c @@ -458,7 +458,7 @@ void R_Draw2sMultiPatchTranslucentColumn_32(void) val = source[frac>>FRACBITS]; if (val != TRANSPARENTPIXEL) - WriteTranslucentColumn(colormap[val]); + WriteTranslucentColumn_s8d32(colormap[val]); dest += vid.width; @@ -483,7 +483,7 @@ void R_Draw2sMultiPatchTranslucentColumn_32(void) val = source[frac>>FRACBITS]; if (val != TRANSPARENTPIXEL) - WriteTranslucentColumn32(colormapu32[val]); + WriteTranslucentColumn_s32d32(colormapu32[val]); dest += vid.width; @@ -533,12 +533,12 @@ void R_Draw2sMultiPatchTranslucentColumn_32(void) { val = source[(frac>>FRACBITS) & heightmask]; if (val != TRANSPARENTPIXEL) - WriteTranslucentColumn(colormap[val]); + WriteTranslucentColumn_s8d32(colormap[val]); dest += vid.width; frac += fracstep; val = source[(frac>>FRACBITS) & heightmask]; if (val != TRANSPARENTPIXEL) - WriteTranslucentColumn(colormap[val]); + WriteTranslucentColumn_s8d32(colormap[val]); dest += vid.width; frac += fracstep; } @@ -546,7 +546,7 @@ void R_Draw2sMultiPatchTranslucentColumn_32(void) { val = source[(frac>>FRACBITS) & heightmask]; if (val != TRANSPARENTPIXEL) - WriteTranslucentColumn(colormap[val]); + WriteTranslucentColumn_s8d32(colormap[val]); } } else if (dc_colmapstyle == TC_COLORMAPSTYLE_32BPP) @@ -556,12 +556,12 @@ void R_Draw2sMultiPatchTranslucentColumn_32(void) { val = source[(frac>>FRACBITS) & heightmask]; if (val != TRANSPARENTPIXEL) - WriteTranslucentColumn32(colormapu32[val]); + WriteTranslucentColumn_s32d32(colormapu32[val]); dest += vid.width; frac += fracstep; val = source[(frac>>FRACBITS) & heightmask]; if (val != TRANSPARENTPIXEL) - WriteTranslucentColumn32(colormapu32[val]); + WriteTranslucentColumn_s32d32(colormapu32[val]); dest += vid.width; frac += fracstep; } @@ -569,7 +569,7 @@ void R_Draw2sMultiPatchTranslucentColumn_32(void) { val = source[(frac>>FRACBITS) & heightmask]; if (val != TRANSPARENTPIXEL) - WriteTranslucentColumn32(colormapu32[val]); + WriteTranslucentColumn_s32d32(colormapu32[val]); } } } @@ -700,7 +700,7 @@ void R_DrawTranslucentColumn_32(void) // Re-map color indices from wall texture column // using a lighting/special effects LUT. // heightmask is the Tutti-Frutti fix - WriteTranslucentColumn(colormap[source[frac>>FRACBITS]]); + WriteTranslucentColumn_s8d32(colormap[source[frac>>FRACBITS]]); dest += vid.width; if ((frac += fracstep) >= heightmask) frac -= heightmask; @@ -715,7 +715,7 @@ void R_DrawTranslucentColumn_32(void) // Re-map color indices from wall texture column // using a lighting/special effects LUT. // heightmask is the Tutti-Frutti fix - WriteTranslucentColumn32(colormapu32[source[frac>>FRACBITS]]); + WriteTranslucentColumn_s32d32(colormapu32[source[frac>>FRACBITS]]); dest += vid.width; if ((frac += fracstep) >= heightmask) frac -= heightmask; @@ -746,30 +746,30 @@ void R_DrawTranslucentColumn_32(void) { while ((count -= 2) >= 0) // texture height is a power of 2 { - WriteTranslucentColumn(colormap[source[(frac>>FRACBITS)&heightmask]]); + WriteTranslucentColumn_s8d32(colormap[source[(frac>>FRACBITS)&heightmask]]); dest += vid.width; frac += fracstep; - WriteTranslucentColumn(colormap[source[(frac>>FRACBITS)&heightmask]]); + WriteTranslucentColumn_s8d32(colormap[source[(frac>>FRACBITS)&heightmask]]); dest += vid.width; frac += fracstep; } if (count & 1) - WriteTranslucentColumn(colormap[source[(frac>>FRACBITS)&heightmask]]); + WriteTranslucentColumn_s8d32(colormap[source[(frac>>FRACBITS)&heightmask]]); } else if (dc_colmapstyle == TC_COLORMAPSTYLE_32BPP) { colormapu32 = (lighttable_u32_t *)colormap; while ((count -= 2) >= 0) // texture height is a power of 2 { - WriteTranslucentColumn32(colormapu32[source[(frac>>FRACBITS)&heightmask]]); + WriteTranslucentColumn_s32d32(colormapu32[source[(frac>>FRACBITS)&heightmask]]); dest += vid.width; frac += fracstep; - WriteTranslucentColumn32(colormapu32[source[(frac>>FRACBITS)&heightmask]]); + WriteTranslucentColumn_s32d32(colormapu32[source[(frac>>FRACBITS)&heightmask]]); dest += vid.width; frac += fracstep; } if (count & 1) - WriteTranslucentColumn32(colormapu32[source[(frac>>FRACBITS)&heightmask]]); + WriteTranslucentColumn_s32d32(colormapu32[source[(frac>>FRACBITS)&heightmask]]); } } else if (dc_picfmt == PICFMT_PATCH32) @@ -867,7 +867,7 @@ void R_DrawTranslatedTranslucentColumn_32(void) // Re-map color indices from wall texture column // using a lighting/special effects LUT. // heightmask is the Tutti-Frutti fix - WriteTranslucentColumn(colormap[dc_translation[source[frac>>FRACBITS]]]); + WriteTranslucentColumn_s8d32(colormap[dc_translation[source[frac>>FRACBITS]]]); dest += vid.width; if ((frac += fracstep) >= heightmask) frac -= heightmask; @@ -882,7 +882,7 @@ void R_DrawTranslatedTranslucentColumn_32(void) // Re-map color indices from wall texture column // using a lighting/special effects LUT. // heightmask is the Tutti-Frutti fix - WriteTranslucentColumn32(colormapu32[dc_translation[source[frac>>FRACBITS]]]); + WriteTranslucentColumn_s32d32(colormapu32[dc_translation[source[frac>>FRACBITS]]]); dest += vid.width; if ((frac += fracstep) >= heightmask) frac -= heightmask; @@ -913,30 +913,30 @@ void R_DrawTranslatedTranslucentColumn_32(void) { while ((count -= 2) >= 0) // texture height is a power of 2 { - WriteTranslucentColumn(colormap[dc_translation[source[(frac>>FRACBITS)&heightmask]]]); + WriteTranslucentColumn_s8d32(colormap[dc_translation[source[(frac>>FRACBITS)&heightmask]]]); dest += vid.width; frac += fracstep; - WriteTranslucentColumn(colormap[dc_translation[source[(frac>>FRACBITS)&heightmask]]]); + WriteTranslucentColumn_s8d32(colormap[dc_translation[source[(frac>>FRACBITS)&heightmask]]]); dest += vid.width; frac += fracstep; } if (count & 1) - WriteTranslucentColumn(colormap[dc_translation[source[(frac>>FRACBITS)&heightmask]]]); + WriteTranslucentColumn_s8d32(colormap[dc_translation[source[(frac>>FRACBITS)&heightmask]]]); } else if (dc_colmapstyle == TC_COLORMAPSTYLE_32BPP) { colormapu32 = (lighttable_u32_t *)colormap; while ((count -= 2) >= 0) // texture height is a power of 2 { - WriteTranslucentColumn32(colormapu32[dc_translation[source[(frac>>FRACBITS)&heightmask]]]); + WriteTranslucentColumn_s32d32(colormapu32[dc_translation[source[(frac>>FRACBITS)&heightmask]]]); dest += vid.width; frac += fracstep; - WriteTranslucentColumn32(colormapu32[dc_translation[source[(frac>>FRACBITS)&heightmask]]]); + WriteTranslucentColumn_s32d32(colormapu32[dc_translation[source[(frac>>FRACBITS)&heightmask]]]); dest += vid.width; frac += fracstep; } if (count & 1) - WriteTranslucentColumn32(colormapu32[dc_translation[source[(frac>>FRACBITS)&heightmask]]]); + WriteTranslucentColumn_s32d32(colormapu32[dc_translation[source[(frac>>FRACBITS)&heightmask]]]); } } else if (dc_picfmt == PICFMT_PATCH32) @@ -1092,46 +1092,6 @@ void R_DrawSpan_32(void) { if (ds_colmapstyle == TC_COLORMAPSTYLE_8BPP) { - while (count >= 8) - { - // SoM: Why didn't I see this earlier? the spot variable is a waste now because we don't - // have the uber complicated math to calculate it now, so that was a memory write we didn't - // need! - dest[0] = GetTrueColor(colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]]); - xposition += xstep; - yposition += ystep; - - dest[1] = GetTrueColor(colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]]); - xposition += xstep; - yposition += ystep; - - dest[2] = GetTrueColor(colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]]); - xposition += xstep; - yposition += ystep; - - dest[3] = GetTrueColor(colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]]); - xposition += xstep; - yposition += ystep; - - dest[4] = GetTrueColor(colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]]); - xposition += xstep; - yposition += ystep; - - dest[5] = GetTrueColor(colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]]); - xposition += xstep; - yposition += ystep; - - dest[6] = GetTrueColor(colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]]); - xposition += xstep; - yposition += ystep; - - dest[7] = GetTrueColor(colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]]); - xposition += xstep; - yposition += ystep; - - dest += 8; - count -= 8; - } while (count-- && dest <= deststop) { *dest = GetTrueColor(colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]]); @@ -1142,46 +1102,6 @@ void R_DrawSpan_32(void) } else if (ds_colmapstyle == TC_COLORMAPSTYLE_32BPP) { - while (count >= 8) - { - // SoM: Why didn't I see this earlier? the spot variable is a waste now because we don't - // have the uber complicated math to calculate it now, so that was a memory write we didn't - // need! - dest[0] = TC_Colormap32Mix(colormapu32[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]]); - xposition += xstep; - yposition += ystep; - - dest[1] = TC_Colormap32Mix(colormapu32[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]]); - xposition += xstep; - yposition += ystep; - - dest[2] = TC_Colormap32Mix(colormapu32[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]]); - xposition += xstep; - yposition += ystep; - - dest[3] = TC_Colormap32Mix(colormapu32[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]]); - xposition += xstep; - yposition += ystep; - - dest[4] = TC_Colormap32Mix(colormapu32[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]]); - xposition += xstep; - yposition += ystep; - - dest[5] = TC_Colormap32Mix(colormapu32[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]]); - xposition += xstep; - yposition += ystep; - - dest[6] = TC_Colormap32Mix(colormapu32[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]]); - xposition += xstep; - yposition += ystep; - - dest[7] = TC_Colormap32Mix(colormapu32[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]]); - xposition += xstep; - yposition += ystep; - - dest += 8; - count -= 8; - } while (count-- && dest <= deststop) { *dest = TC_Colormap32Mix(colormapu32[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]]); @@ -1193,46 +1113,6 @@ void R_DrawSpan_32(void) } else if (ds_picfmt == PICFMT_FLAT32) { - while (count >= 8) - { - // SoM: Why didn't I see this earlier? the spot variable is a waste now because we don't - // have the uber complicated math to calculate it now, so that was a memory write we didn't - // need! - dest[0] = TC_ColorMix(sourceu32[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)], dest[0]); - xposition += xstep; - yposition += ystep; - - dest[1] = TC_ColorMix(sourceu32[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)], dest[1]); - xposition += xstep; - yposition += ystep; - - dest[2] = TC_ColorMix(sourceu32[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)], dest[2]); - xposition += xstep; - yposition += ystep; - - dest[3] = TC_ColorMix(sourceu32[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)], dest[3]); - xposition += xstep; - yposition += ystep; - - dest[4] = TC_ColorMix(sourceu32[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)], dest[4]); - xposition += xstep; - yposition += ystep; - - dest[5] = TC_ColorMix(sourceu32[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)], dest[5]); - xposition += xstep; - yposition += ystep; - - dest[6] = TC_ColorMix(sourceu32[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)], dest[6]); - xposition += xstep; - yposition += ystep; - - dest[7] = TC_ColorMix(sourceu32[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)], dest[7]); - xposition += xstep; - yposition += ystep; - - dest += 8; - count -= 8; - } while (count-- && dest <= deststop) { *dest = TC_ColorMix(sourceu32[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)], *dest); @@ -1547,7 +1427,7 @@ void R_DrawTiltedTranslucentSpan_32(void) for (i = SPANSIZE-1; i >= 0; i--) { colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); - WriteTranslucentSpan(colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]]); + WriteTranslucentSpan_s8d32(colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]]); dest++; u += stepu; v += stepv; @@ -1563,7 +1443,7 @@ void R_DrawTiltedTranslucentSpan_32(void) u = (INT64)(startu); v = (INT64)(startv); colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); - WriteTranslucentSpan(colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]]); + WriteTranslucentSpan_s8d32(colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]]); } else { @@ -1584,7 +1464,7 @@ void R_DrawTiltedTranslucentSpan_32(void) for (; width != 0; width--) { colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); - WriteTranslucentSpan(colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]]); + WriteTranslucentSpan_s8d32(colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]]); dest++; u += stepu; v += stepv; @@ -1611,7 +1491,7 @@ void R_DrawTiltedTranslucentSpan_32(void) for (i = SPANSIZE-1; i >= 0; i--) { colormapu32 = planezlight_u32[tiltlighting[ds_x1++]] + ((UINT32*)ds_colormap - colormaps_u32); - WriteTranslucentSpan32(colormapu32[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]]); + WriteTranslucentSpan_s32d32(colormapu32[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]]); dest++; u += stepu; v += stepv; @@ -1627,7 +1507,7 @@ void R_DrawTiltedTranslucentSpan_32(void) u = (INT64)(startu); v = (INT64)(startv); colormapu32 = planezlight_u32[tiltlighting[ds_x1++]] + ((UINT32*)ds_colormap - colormaps_u32); - WriteTranslucentSpan32(colormapu32[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]]); + WriteTranslucentSpan_s32d32(colormapu32[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]]); } else { @@ -1648,7 +1528,7 @@ void R_DrawTiltedTranslucentSpan_32(void) for (; width != 0; width--) { colormapu32 = planezlight_u32[tiltlighting[ds_x1++]] + ((UINT32*)ds_colormap - colormaps_u32); - WriteTranslucentSpan32(colormapu32[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]]); + WriteTranslucentSpan_s32d32(colormapu32[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]]); dest++; u += stepu; v += stepv; @@ -1789,7 +1669,7 @@ void R_DrawTiltedWaterSpan_32(void) for (i = SPANSIZE-1; i >= 0; i--) { colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); - WriteTranslucentWaterSpan(colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]]); + WriteTranslucentWaterSpan_s8d32(colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]]); dest++; u += stepu; v += stepv; @@ -1805,7 +1685,7 @@ void R_DrawTiltedWaterSpan_32(void) u = (INT64)(startu); v = (INT64)(startv); colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); - WriteTranslucentWaterSpan(colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]]); + WriteTranslucentWaterSpan_s8d32(colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]]); } else { @@ -1826,7 +1706,7 @@ void R_DrawTiltedWaterSpan_32(void) for (; width != 0; width--) { colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); - WriteTranslucentWaterSpan(colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]]); + WriteTranslucentWaterSpan_s8d32(colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]]); dest++; u += stepu; v += stepv; @@ -1853,7 +1733,7 @@ void R_DrawTiltedWaterSpan_32(void) for (i = SPANSIZE-1; i >= 0; i--) { colormapu32 = planezlight_u32[tiltlighting[ds_x1++]] + ((UINT32*)ds_colormap - colormaps_u32); - WriteTranslucentWaterSpan32(colormapu32[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]]); + WriteTranslucentWaterSpan_s32d32(colormapu32[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]]); dest++; u += stepu; v += stepv; @@ -1869,7 +1749,7 @@ void R_DrawTiltedWaterSpan_32(void) u = (INT64)(startu); v = (INT64)(startv); colormapu32 = planezlight_u32[tiltlighting[ds_x1++]] + ((UINT32*)ds_colormap - colormaps_u32); - WriteTranslucentWaterSpan32(colormapu32[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]]); + WriteTranslucentWaterSpan_s32d32(colormapu32[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]]); } else { @@ -1890,7 +1770,7 @@ void R_DrawTiltedWaterSpan_32(void) for (; width != 0; width--) { colormapu32 = planezlight_u32[tiltlighting[ds_x1++]] + ((UINT32*)ds_colormap - colormaps_u32); - WriteTranslucentWaterSpan32(colormapu32[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]]); + WriteTranslucentWaterSpan_s32d32(colormapu32[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]]); dest++; u += stepu; v += stepv; @@ -2272,80 +2152,6 @@ void R_DrawSplat_32(void) { if (ds_colmapstyle == TC_COLORMAPSTYLE_8BPP) { - while (count >= 8) - { - // SoM: Why didn't I see this earlier? the spot variable is a waste now because we don't - // have the uber complicated math to calculate it now, so that was a memory write we didn't - // need! - // - // <Callum> 4194303 = (2048x2048)-1 (2048x2048 is maximum flat size) - val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val &= 4194303; - val = source[val]; - if (val != TRANSPARENTPIXEL) - dest[0] = GetTrueColor(colormap[val]); - xposition += xstep; - yposition += ystep; - - val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val &= 4194303; - val = source[val]; - if (val != TRANSPARENTPIXEL) - dest[1] = GetTrueColor(colormap[val]); - xposition += xstep; - yposition += ystep; - - val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val &= 4194303; - val = source[val]; - if (val != TRANSPARENTPIXEL) - dest[2] = GetTrueColor(colormap[val]); - xposition += xstep; - yposition += ystep; - - val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val &= 4194303; - val = source[val]; - if (val != TRANSPARENTPIXEL) - dest[3] = GetTrueColor(colormap[val]); - xposition += xstep; - yposition += ystep; - - val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val &= 4194303; - val = source[val]; - if (val != TRANSPARENTPIXEL) - dest[4] = GetTrueColor(colormap[val]); - xposition += xstep; - yposition += ystep; - - val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val &= 4194303; - val = source[val]; - if (val != TRANSPARENTPIXEL) - dest[5] = GetTrueColor(colormap[val]); - xposition += xstep; - yposition += ystep; - - val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val &= 4194303; - val = source[val]; - if (val != TRANSPARENTPIXEL) - dest[6] = GetTrueColor(colormap[val]); - xposition += xstep; - yposition += ystep; - - val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val &= 4194303; - val = source[val]; - if (val != TRANSPARENTPIXEL) - dest[7] = GetTrueColor(colormap[val]); - xposition += xstep; - yposition += ystep; - - dest += 8; - count -= 8; - } while (count-- && dest <= deststop) { val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; @@ -2358,80 +2164,6 @@ void R_DrawSplat_32(void) } else if (ds_colmapstyle == TC_COLORMAPSTYLE_32BPP) { - while (count >= 8) - { - // SoM: Why didn't I see this earlier? the spot variable is a waste now because we don't - // have the uber complicated math to calculate it now, so that was a memory write we didn't - // need! - // - // <Callum> 4194303 = (2048x2048)-1 (2048x2048 is maximum flat size) - val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val &= 4194303; - val = source[val]; - if (val != TRANSPARENTPIXEL) - dest[0] = TC_Colormap32Mix(colormapu32[val]); - xposition += xstep; - yposition += ystep; - - val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val &= 4194303; - val = source[val]; - if (val != TRANSPARENTPIXEL) - dest[1] = TC_Colormap32Mix(colormapu32[val]); - xposition += xstep; - yposition += ystep; - - val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val &= 4194303; - val = source[val]; - if (val != TRANSPARENTPIXEL) - dest[2] = TC_Colormap32Mix(colormapu32[val]); - xposition += xstep; - yposition += ystep; - - val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val &= 4194303; - val = source[val]; - if (val != TRANSPARENTPIXEL) - dest[3] = TC_Colormap32Mix(colormapu32[val]); - xposition += xstep; - yposition += ystep; - - val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val &= 4194303; - val = source[val]; - if (val != TRANSPARENTPIXEL) - dest[4] = TC_Colormap32Mix(colormapu32[val]); - xposition += xstep; - yposition += ystep; - - val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val &= 4194303; - val = source[val]; - if (val != TRANSPARENTPIXEL) - dest[5] = TC_Colormap32Mix(colormapu32[val]); - xposition += xstep; - yposition += ystep; - - val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val &= 4194303; - val = source[val]; - if (val != TRANSPARENTPIXEL) - dest[6] = TC_Colormap32Mix(colormapu32[val]); - xposition += xstep; - yposition += ystep; - - val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val &= 4194303; - val = source[val]; - if (val != TRANSPARENTPIXEL) - dest[7] = TC_Colormap32Mix(colormapu32[val]); - xposition += xstep; - yposition += ystep; - - dest += 8; - count -= 8; - } while (count-- && dest <= deststop) { val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; @@ -2445,80 +2177,6 @@ void R_DrawSplat_32(void) } else if (ds_picfmt == PICFMT_FLAT32) { - while (count >= 8) - { - // SoM: Why didn't I see this earlier? the spot variable is a waste now because we don't - // have the uber complicated math to calculate it now, so that was a memory write we didn't - // need! - // - // <Callum> 4194303 = (2048x2048)-1 (2048x2048 is maximum flat size) - val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val &= 4194303; - val = sourceu32[val]; - if (R_GetRgbaA(val)) - dest[0] = TC_ColorMix(val, dest[0]); - xposition += xstep; - yposition += ystep; - - val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val &= 4194303; - val = sourceu32[val]; - if (R_GetRgbaA(val)) - dest[1] = TC_ColorMix(val, dest[1]); - xposition += xstep; - yposition += ystep; - - val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val &= 4194303; - val = sourceu32[val]; - if (R_GetRgbaA(val)) - dest[2] = TC_ColorMix(val, dest[2]); - xposition += xstep; - yposition += ystep; - - val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val &= 4194303; - val = sourceu32[val]; - if (R_GetRgbaA(val)) - dest[3] = TC_ColorMix(val, dest[3]); - xposition += xstep; - yposition += ystep; - - val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val &= 4194303; - val = sourceu32[val]; - if (R_GetRgbaA(val)) - dest[4] = TC_ColorMix(val, dest[4]); - xposition += xstep; - yposition += ystep; - - val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val &= 4194303; - val = sourceu32[val]; - if (R_GetRgbaA(val)) - dest[5] = TC_ColorMix(val, dest[5]); - xposition += xstep; - yposition += ystep; - - val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val &= 4194303; - val = sourceu32[val]; - if (R_GetRgbaA(val)) - dest[6] = TC_ColorMix(val, dest[6]); - xposition += xstep; - yposition += ystep; - - val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val &= 4194303; - val = sourceu32[val]; - if (R_GetRgbaA(val)) - dest[7] = TC_ColorMix(val, dest[7]); - xposition += xstep; - yposition += ystep; - - dest += 8; - count -= 8; - } while (count-- && dest <= deststop) { val = sourceu32[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; @@ -2579,67 +2237,11 @@ void R_DrawTranslucentSplat_32(void) { if (ds_colmapstyle == TC_COLORMAPSTYLE_8BPP) { - while (count >= 8) - { - // SoM: Why didn't I see this earlier? the spot variable is a waste now because we don't - // have the uber complicated math to calculate it now, so that was a memory write we didn't - // need! - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val != TRANSPARENTPIXEL) - WriteTranslucentSpanIdx(colormap[val], 0); - xposition += xstep; - yposition += ystep; - - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val != TRANSPARENTPIXEL) - WriteTranslucentSpanIdx(colormap[val], 1); - xposition += xstep; - yposition += ystep; - - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val != TRANSPARENTPIXEL) - WriteTranslucentSpanIdx(colormap[val], 2); - xposition += xstep; - yposition += ystep; - - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val != TRANSPARENTPIXEL) - WriteTranslucentSpanIdx(colormap[val], 3); - xposition += xstep; - yposition += ystep; - - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val != TRANSPARENTPIXEL) - WriteTranslucentSpanIdx(colormap[val], 4); - xposition += xstep; - yposition += ystep; - - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val != TRANSPARENTPIXEL) - WriteTranslucentSpanIdx(colormap[val], 5); - xposition += xstep; - yposition += ystep; - - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val != TRANSPARENTPIXEL) - WriteTranslucentSpanIdx(colormap[val], 6); - xposition += xstep; - yposition += ystep; - - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val != TRANSPARENTPIXEL) - WriteTranslucentSpanIdx(colormap[val], 7); - xposition += xstep; - yposition += ystep; - - dest += 8; - count -= 8; - } while (count-- && dest <= deststop) { val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; if (val != TRANSPARENTPIXEL) - WriteTranslucentSpan(colormap[val]); + WriteTranslucentSpan_s8d32(colormap[val]); dest++; xposition += xstep; yposition += ystep; @@ -2647,67 +2249,11 @@ void R_DrawTranslucentSplat_32(void) } else if (ds_colmapstyle == TC_COLORMAPSTYLE_32BPP) { - while (count >= 8) - { - // SoM: Why didn't I see this earlier? the spot variable is a waste now because we don't - // have the uber complicated math to calculate it now, so that was a memory write we didn't - // need! - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val != TRANSPARENTPIXEL) - WriteTranslucentSpanIdx32(colormapu32[val], 0); - xposition += xstep; - yposition += ystep; - - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val != TRANSPARENTPIXEL) - WriteTranslucentSpanIdx32(colormapu32[val], 1); - xposition += xstep; - yposition += ystep; - - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val != TRANSPARENTPIXEL) - WriteTranslucentSpanIdx32(colormapu32[val], 2); - xposition += xstep; - yposition += ystep; - - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val != TRANSPARENTPIXEL) - WriteTranslucentSpanIdx32(colormapu32[val], 3); - xposition += xstep; - yposition += ystep; - - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val != TRANSPARENTPIXEL) - WriteTranslucentSpanIdx32(colormapu32[val], 4); - xposition += xstep; - yposition += ystep; - - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val != TRANSPARENTPIXEL) - WriteTranslucentSpanIdx32(colormapu32[val], 5); - xposition += xstep; - yposition += ystep; - - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val != TRANSPARENTPIXEL) - WriteTranslucentSpanIdx32(colormapu32[val], 6); - xposition += xstep; - yposition += ystep; - - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val != TRANSPARENTPIXEL) - WriteTranslucentSpanIdx32(colormapu32[val], 7); - xposition += xstep; - yposition += ystep; - - dest += 8; - count -= 8; - } while (count-- && dest <= deststop) { val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; if (val != TRANSPARENTPIXEL) - WriteTranslucentSpan32(colormapu32[val]); + WriteTranslucentSpan_s32d32(colormapu32[val]); dest++; xposition += xstep; yposition += ystep; @@ -2716,62 +2262,6 @@ void R_DrawTranslucentSplat_32(void) } else if (ds_picfmt == PICFMT_FLAT32) { - while (count >= 8) - { - // SoM: Why didn't I see this earlier? the spot variable is a waste now because we don't - // have the uber complicated math to calculate it now, so that was a memory write we didn't - // need! - val = sourceu32[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (R_GetRgbaA(val)) - dest[0] = R_BlendModeMix(val, dest[0], ds_alpha); - xposition += xstep; - yposition += ystep; - - val = sourceu32[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (R_GetRgbaA(val)) - dest[1] = R_BlendModeMix(val, dest[1], ds_alpha); - xposition += xstep; - yposition += ystep; - - val = sourceu32[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (R_GetRgbaA(val)) - dest[2] = R_BlendModeMix(val, dest[2], ds_alpha); - xposition += xstep; - yposition += ystep; - - val = sourceu32[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (R_GetRgbaA(val)) - dest[3] = R_BlendModeMix(val, dest[3], ds_alpha); - xposition += xstep; - yposition += ystep; - - val = sourceu32[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (R_GetRgbaA(val)) - dest[4] = R_BlendModeMix(val, dest[4], ds_alpha); - xposition += xstep; - yposition += ystep; - - val = sourceu32[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (R_GetRgbaA(val)) - dest[5] = R_BlendModeMix(val, dest[5], ds_alpha); - xposition += xstep; - yposition += ystep; - - val = sourceu32[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (R_GetRgbaA(val)) - dest[6] = R_BlendModeMix(val, dest[6], ds_alpha); - xposition += xstep; - yposition += ystep; - - val = sourceu32[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (R_GetRgbaA(val)) - dest[7] = R_BlendModeMix(val, dest[7], ds_alpha); - xposition += xstep; - yposition += ystep; - - dest += 8; - count -= 8; - } while (count-- && dest <= deststop) { val = sourceu32[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; @@ -2927,7 +2417,7 @@ void R_DrawTranslucentFloorSprite_32(void) { val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); if (val & 0xFF00) - WriteTranslucentSpan(colormap[translation[source[val & 0xFF]]]); + WriteTranslucentSpan_s8d32(colormap[translation[source[val & 0xFF]]]); dest++; xposition += xstep; yposition += ystep; @@ -2939,7 +2429,7 @@ void R_DrawTranslucentFloorSprite_32(void) { val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); if (val & 0xFF00) - WriteTranslucentSpan32(colormapu32[translation[source[val & 0xFF]]]); + WriteTranslucentSpan_s32d32(colormapu32[translation[source[val & 0xFF]]]); dest++; xposition += xstep; yposition += ystep; @@ -3286,7 +2776,7 @@ void R_DrawTiltedTranslucentFloorSprite_32(void) { val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]; if (val & 0xFF00) - WriteTranslucentSpan(colormap[translation[val & 0xFF]]); + WriteTranslucentSpan_s8d32(colormap[translation[val & 0xFF]]); dest++; u += stepu; v += stepv; @@ -3303,7 +2793,7 @@ void R_DrawTiltedTranslucentFloorSprite_32(void) v = (INT64)(startv); val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]; if (val & 0xFF00) - WriteTranslucentSpan(colormap[translation[val & 0xFF]]); + WriteTranslucentSpan_s8d32(colormap[translation[val & 0xFF]]); } else { @@ -3325,7 +2815,7 @@ void R_DrawTiltedTranslucentFloorSprite_32(void) { val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]; if (val & 0xFF00) - WriteTranslucentSpan(colormap[translation[val & 0xFF]]); + WriteTranslucentSpan_s8d32(colormap[translation[val & 0xFF]]); dest++; u += stepu; v += stepv; @@ -3353,7 +2843,7 @@ void R_DrawTiltedTranslucentFloorSprite_32(void) { val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]; if (val & 0xFF00) - WriteTranslucentSpan32(colormapu32[translation[val & 0xFF]]); + WriteTranslucentSpan_s32d32(colormapu32[translation[val & 0xFF]]); dest++; u += stepu; v += stepv; @@ -3369,7 +2859,7 @@ void R_DrawTiltedTranslucentFloorSprite_32(void) u = (INT64)(startu); v = (INT64)(startv); colormapu32 = planezlight_u32[tiltlighting[ds_x1++]] + ((UINT32*)ds_colormap - colormaps_u32); - WriteTranslucentSpan32(colormapu32[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]]); + WriteTranslucentSpan_s32d32(colormapu32[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]]); } else { @@ -3391,7 +2881,7 @@ void R_DrawTiltedTranslucentFloorSprite_32(void) { val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]; if (val & 0xFF00) - WriteTranslucentSpan32(colormapu32[translation[val & 0xFF]]); + WriteTranslucentSpan_s32d32(colormapu32[translation[val & 0xFF]]); dest++; u += stepu; v += stepv; @@ -3517,50 +3007,10 @@ void R_DrawTranslucentSpan_32(void) { if (ds_colmapstyle == TC_COLORMAPSTYLE_8BPP) { - while (count >= 8) - { - // SoM: Why didn't I see this earlier? the spot variable is a waste now because we don't - // have the uber complicated math to calculate it now, so that was a memory write we didn't - // need! - WriteTranslucentSpanIdx(colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]], 0); - xposition += xstep; - yposition += ystep; - - WriteTranslucentSpanIdx(colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]], 1); - xposition += xstep; - yposition += ystep; - - WriteTranslucentSpanIdx(colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]], 2); - xposition += xstep; - yposition += ystep; - - WriteTranslucentSpanIdx(colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]], 3); - xposition += xstep; - yposition += ystep; - - WriteTranslucentSpanIdx(colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]], 4); - xposition += xstep; - yposition += ystep; - - WriteTranslucentSpanIdx(colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]], 5); - xposition += xstep; - yposition += ystep; - - WriteTranslucentSpanIdx(colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]], 6); - xposition += xstep; - yposition += ystep; - - WriteTranslucentSpanIdx(colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]], 7); - xposition += xstep; - yposition += ystep; - - dest += 8; - count -= 8; - } while (count-- && dest <= deststop) { val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - WriteTranslucentSpan(colormap[source[val]]); + WriteTranslucentSpan_s8d32(colormap[source[val]]); dest++; xposition += xstep; yposition += ystep; @@ -3568,50 +3018,10 @@ void R_DrawTranslucentSpan_32(void) } else if (ds_colmapstyle == TC_COLORMAPSTYLE_32BPP) { - while (count >= 8) - { - // SoM: Why didn't I see this earlier? the spot variable is a waste now because we don't - // have the uber complicated math to calculate it now, so that was a memory write we didn't - // need! - WriteTranslucentSpanIdx32(colormapu32[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]], 0); - xposition += xstep; - yposition += ystep; - - WriteTranslucentSpanIdx32(colormapu32[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]], 1); - xposition += xstep; - yposition += ystep; - - WriteTranslucentSpanIdx32(colormapu32[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]], 2); - xposition += xstep; - yposition += ystep; - - WriteTranslucentSpanIdx32(colormapu32[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]], 3); - xposition += xstep; - yposition += ystep; - - WriteTranslucentSpanIdx32(colormapu32[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]], 4); - xposition += xstep; - yposition += ystep; - - WriteTranslucentSpanIdx32(colormapu32[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]], 5); - xposition += xstep; - yposition += ystep; - - WriteTranslucentSpanIdx32(colormapu32[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]], 6); - xposition += xstep; - yposition += ystep; - - WriteTranslucentSpanIdx32(colormapu32[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]], 7); - xposition += xstep; - yposition += ystep; - - dest += 8; - count -= 8; - } while (count-- && dest <= deststop) { val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - WriteTranslucentSpan32(colormapu32[source[val]]); + WriteTranslucentSpan_s32d32(colormapu32[source[val]]); dest++; xposition += xstep; yposition += ystep; @@ -3620,46 +3030,6 @@ void R_DrawTranslucentSpan_32(void) } else if (ds_picfmt == PICFMT_FLAT32) { - while (count >= 8) - { - // SoM: Why didn't I see this earlier? the spot variable is a waste now because we don't - // have the uber complicated math to calculate it now, so that was a memory write we didn't - // need! - dest[0] = R_BlendModeMix(sourceu32[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)], dest[0], ds_alpha); - xposition += xstep; - yposition += ystep; - - dest[1] = R_BlendModeMix(sourceu32[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)], dest[1], ds_alpha); - xposition += xstep; - yposition += ystep; - - dest[2] = R_BlendModeMix(sourceu32[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)], dest[2], ds_alpha); - xposition += xstep; - yposition += ystep; - - dest[3] = R_BlendModeMix(sourceu32[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)], dest[3], ds_alpha); - xposition += xstep; - yposition += ystep; - - dest[4] = R_BlendModeMix(sourceu32[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)], dest[4], ds_alpha); - xposition += xstep; - yposition += ystep; - - dest[5] = R_BlendModeMix(sourceu32[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)], dest[5], ds_alpha); - xposition += xstep; - yposition += ystep; - - dest[6] = R_BlendModeMix(sourceu32[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)], dest[6], ds_alpha); - xposition += xstep; - yposition += ystep; - - dest[7] = R_BlendModeMix(sourceu32[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)], dest[7], ds_alpha); - xposition += xstep; - yposition += ystep; - - dest += 8; - count -= 8; - } while (count-- && dest <= deststop) { val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); @@ -3714,49 +3084,9 @@ void R_DrawWaterSpan_32(void) { if (ds_colmapstyle == TC_COLORMAPSTYLE_8BPP) { - while (count >= 8) - { - // SoM: Why didn't I see this earlier? the spot variable is a waste now because we don't - // have the uber complicated math to calculate it now, so that was a memory write we didn't - // need! - WriteTranslucentWaterSpanIdx(colormap[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]], 0); - xposition += xstep; - yposition += ystep; - - WriteTranslucentWaterSpanIdx(colormap[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]], 1); - xposition += xstep; - yposition += ystep; - - WriteTranslucentWaterSpanIdx(colormap[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]], 2); - xposition += xstep; - yposition += ystep; - - WriteTranslucentWaterSpanIdx(colormap[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]], 3); - xposition += xstep; - yposition += ystep; - - WriteTranslucentWaterSpanIdx(colormap[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]], 4); - xposition += xstep; - yposition += ystep; - - WriteTranslucentWaterSpanIdx(colormap[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]], 5); - xposition += xstep; - yposition += ystep; - - WriteTranslucentWaterSpanIdx(colormap[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]], 6); - xposition += xstep; - yposition += ystep; - - WriteTranslucentWaterSpanIdx(colormap[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]], 7); - xposition += xstep; - yposition += ystep; - - dest += 8; - count -= 8; - } while (count--) { - WriteTranslucentWaterSpan(colormap[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]]); + WriteTranslucentWaterSpan_s8d32(colormap[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]]); dest++; xposition += xstep; yposition += ystep; @@ -3764,49 +3094,9 @@ void R_DrawWaterSpan_32(void) } else if (ds_colmapstyle == TC_COLORMAPSTYLE_32BPP) { - while (count >= 8) - { - // SoM: Why didn't I see this earlier? the spot variable is a waste now because we don't - // have the uber complicated math to calculate it now, so that was a memory write we didn't - // need! - WriteTranslucentWaterSpanIdx32(colormapu32[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]], 0); - xposition += xstep; - yposition += ystep; - - WriteTranslucentWaterSpanIdx32(colormapu32[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]], 1); - xposition += xstep; - yposition += ystep; - - WriteTranslucentWaterSpanIdx32(colormapu32[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]], 2); - xposition += xstep; - yposition += ystep; - - WriteTranslucentWaterSpanIdx32(colormapu32[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]], 3); - xposition += xstep; - yposition += ystep; - - WriteTranslucentWaterSpanIdx32(colormapu32[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]], 4); - xposition += xstep; - yposition += ystep; - - WriteTranslucentWaterSpanIdx32(colormapu32[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]], 5); - xposition += xstep; - yposition += ystep; - - WriteTranslucentWaterSpanIdx32(colormapu32[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]], 6); - xposition += xstep; - yposition += ystep; - - WriteTranslucentWaterSpanIdx32(colormapu32[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]], 7); - xposition += xstep; - yposition += ystep; - - dest += 8; - count -= 8; - } while (count--) { - WriteTranslucentWaterSpan32(colormapu32[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]]); + WriteTranslucentWaterSpan_s32d32(colormapu32[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]]); dest++; xposition += xstep; yposition += ystep; @@ -3815,46 +3105,6 @@ void R_DrawWaterSpan_32(void) } else if (ds_picfmt == PICFMT_FLAT32) { - while (count >= 8) - { - // SoM: Why didn't I see this earlier? the spot variable is a waste now because we don't - // have the uber complicated math to calculate it now, so that was a memory write we didn't - // need! - dest[0] = R_BlendModeMix(sourceu32[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)], *dsrc++, ds_alpha); - xposition += xstep; - yposition += ystep; - - dest[1] = R_BlendModeMix(sourceu32[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)], *dsrc++, ds_alpha); - xposition += xstep; - yposition += ystep; - - dest[2] = R_BlendModeMix(sourceu32[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)], *dsrc++, ds_alpha); - xposition += xstep; - yposition += ystep; - - dest[3] = R_BlendModeMix(sourceu32[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)], *dsrc++, ds_alpha); - xposition += xstep; - yposition += ystep; - - dest[4] = R_BlendModeMix(sourceu32[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)], *dsrc++, ds_alpha); - xposition += xstep; - yposition += ystep; - - dest[5] = R_BlendModeMix(sourceu32[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)], *dsrc++, ds_alpha); - xposition += xstep; - yposition += ystep; - - dest[6] = R_BlendModeMix(sourceu32[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)], *dsrc++, ds_alpha); - xposition += xstep; - yposition += ystep; - - dest[7] = R_BlendModeMix(sourceu32[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)], *dsrc++, ds_alpha); - xposition += xstep; - yposition += ystep; - - dest += 8; - count -= 8; - } while (count--) { *dest = R_BlendModeMix(sourceu32[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)], *dsrc++, ds_alpha); diff --git a/src/r_draw32_npo2.c b/src/r_draw32_npo2.c index 6f5191e9b2c72d88f96e80eea05e686e49dcc4b1..dcf2a0ecfd5c4ff71b278f877a4b13f3e3f4f186 100644 --- a/src/r_draw32_npo2.c +++ b/src/r_draw32_npo2.c @@ -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; diff --git a/src/r_draw8.c b/src/r_draw8.c index 3f43f4309f3e126bc126f89fbd53c6853f57d754..0384f36ec55704c0983012a5ecd98a213e56084a 100644 --- a/src/r_draw8.c +++ b/src/r_draw8.c @@ -236,7 +236,6 @@ void R_Draw2sMultiPatchTranslucentColumn_8(void) // This is as fast as it gets. { register const UINT8 *source = dc_source; - register const UINT8 *transmap = dc_transmap; register const lighttable_t *colormap = dc_colormap; register INT32 heightmask = dc_texheight-1; register UINT8 val; @@ -259,7 +258,7 @@ void R_Draw2sMultiPatchTranslucentColumn_8(void) val = source[frac>>FRACBITS]; if (val != TRANSPARENTPIXEL) - *dest = *(transmap + (colormap[val]<<8) + (*dest)); + *dest = R_AlphaBlend(colormap[val], dc_alpha, dest); dest += vid.width; @@ -279,12 +278,12 @@ void R_Draw2sMultiPatchTranslucentColumn_8(void) { val = source[(frac>>FRACBITS) & heightmask]; if (val != TRANSPARENTPIXEL) - *dest = *(transmap + (colormap[val]<<8) + (*dest)); + *dest = R_AlphaBlend(colormap[val], dc_alpha, dest); dest += vid.width; frac += fracstep; val = source[(frac>>FRACBITS) & heightmask]; if (val != TRANSPARENTPIXEL) - *dest = *(transmap + (colormap[val]<<8) + (*dest)); + *dest = R_AlphaBlend(colormap[val], dc_alpha, dest); dest += vid.width; frac += fracstep; } @@ -292,103 +291,7 @@ void R_Draw2sMultiPatchTranslucentColumn_8(void) { val = source[(frac>>FRACBITS) & heightmask]; if (val != TRANSPARENTPIXEL) - *dest = *(transmap + (colormap[val]<<8) + (*dest)); - } - } - } -} - -void R_Draw2sMultiPatchAlphaColumn_8(void) -{ - INT32 count; - register UINT8 *dest; - register fixed_t frac; - fixed_t fracstep; - - count = dc_yh - dc_yl; - - if (count < 0) // Zero length, column does not exceed a pixel. - return; - -#ifdef RANGECHECK - if ((unsigned)dc_x >= (unsigned)vid.width || dc_yl < 0 || dc_yh >= vid.height) - return; -#endif - - // Framebuffer destination address. - // Use ylookup LUT to avoid multiply with ScreenWidth. - // Use columnofs LUT for subwindows? - - //dest = ylookup[dc_yl] + columnofs[dc_x]; - dest = &topleft[dc_yl*vid.width + dc_x]; - - count++; - - // Determine scaling, which is the only mapping to be done. - fracstep = dc_iscale; - //frac = dc_texturemid + (dc_yl - centery)*fracstep; - frac = (dc_texturemid + FixedMul((dc_yl << FRACBITS) - centeryfrac, fracstep))*(!dc_hires); - - // Inner loop that does the actual texture mapping, e.g. a DDA-like scaling. - // This is as fast as it gets. - { - register const UINT8 *source = dc_source; - register const lighttable_t *colormap = dc_colormap; - register INT32 heightmask = dc_texheight-1; - register UINT8 val; - if (dc_texheight & heightmask) // not a power of 2 -- killough - { - heightmask++; - heightmask <<= FRACBITS; - - if (frac < 0) - while ((frac += heightmask) < 0); - else - while (frac >= heightmask) - frac -= heightmask; - - do - { - // Re-map color indices from wall texture column - // using a lighting/special effects LUT. - // heightmask is the Tutti-Frutti fix - val = source[frac>>FRACBITS]; - - if (val != TRANSPARENTPIXEL) - *dest = R_AlphaBlend_8(colormap[val], dc_alpha, dest); - - dest += vid.width; - - // Avoid overflow. - if (fracstep > 0x7FFFFFFF - frac) - frac += fracstep - heightmask; - else - frac += fracstep; - - while (frac >= heightmask) - frac -= heightmask; - } while (--count); - } - else - { - while ((count -= 2) >= 0) // texture height is a power of 2 - { - val = source[(frac>>FRACBITS) & heightmask]; - if (val != TRANSPARENTPIXEL) - *dest = R_AlphaBlend_8(colormap[val], dc_alpha, dest); - dest += vid.width; - frac += fracstep; - val = source[(frac>>FRACBITS) & heightmask]; - if (val != TRANSPARENTPIXEL) - *dest = R_AlphaBlend_8(colormap[val], dc_alpha, dest); - dest += vid.width; - frac += fracstep; - } - if (count & 1) - { - val = source[(frac>>FRACBITS) & heightmask]; - if (val != TRANSPARENTPIXEL) - *dest = R_AlphaBlend_8(colormap[val], dc_alpha, dest); + *dest = R_AlphaBlend(colormap[val], dc_alpha, dest); } } } @@ -434,84 +337,6 @@ void R_DrawShadeColumn_8(void) } while (count--); } -/** \brief The R_DrawTranslucentColumn_8 function - I've made an asm routine for the transparency, because it slows down - a lot in 640x480 with big sprites (bfg on all screen, or transparent - walls on fullscreen) -*/ -void R_DrawTranslucentColumn_8(void) -{ - register INT32 count; - register UINT8 *dest; - register fixed_t frac, fracstep; - - count = dc_yh - dc_yl + 1; - - if (count <= 0) // Zero length, column does not exceed a pixel. - return; - -#ifdef RANGECHECK - if ((unsigned)dc_x >= (unsigned)vid.width || dc_yl < 0 || dc_yh >= vid.height) - I_Error("R_DrawTranslucentColumn_8: %d to %d at %d", dc_yl, dc_yh, dc_x); -#endif - - // FIXME. As above. - //dest = ylookup[dc_yl] + columnofs[dc_x]; - dest = &topleft[dc_yl*vid.width + dc_x]; - - // Looks familiar. - fracstep = dc_iscale; - //frac = dc_texturemid + (dc_yl - centery)*fracstep; - frac = (dc_texturemid + FixedMul((dc_yl << FRACBITS) - centeryfrac, fracstep))*(!dc_hires); - - // Inner loop that does the actual texture mapping, e.g. a DDA-like scaling. - // This is as fast as it gets. - { - register const UINT8 *source = dc_source; - register const UINT8 *transmap = dc_transmap; - register const lighttable_t *colormap = dc_colormap; - register INT32 heightmask = dc_texheight - 1; - if (dc_texheight & heightmask) - { - heightmask++; - heightmask <<= FRACBITS; - - if (frac < 0) - while ((frac += heightmask) < 0) - ; - else - while (frac >= heightmask) - frac -= heightmask; - - do - { - // Re-map color indices from wall texture column - // using a lighting/special effects LUT. - // heightmask is the Tutti-Frutti fix - *dest = *(transmap + (colormap[source[frac>>FRACBITS]]<<8) + (*dest)); - dest += vid.width; - if ((frac += fracstep) >= heightmask) - frac -= heightmask; - } - while (--count); - } - else - { - while ((count -= 2) >= 0) // texture height is a power of 2 - { - *dest = *(transmap + (colormap[source[(frac>>FRACBITS)&heightmask]]<<8) + (*dest)); - dest += vid.width; - frac += fracstep; - *dest = *(transmap + (colormap[source[(frac>>FRACBITS)&heightmask]]<<8) + (*dest)); - dest += vid.width; - frac += fracstep; - } - if (count & 1) - *dest = *(transmap + (colormap[source[(frac>>FRACBITS)&heightmask]]<<8) + (*dest)); - } - } -} - // Hack: A cut-down copy of R_DrawTranslucentColumn_8 that does not read texture // data since something about calculating the texture reading address for drop shadows is broken. // dc_texturemid and dc_iscale get wrong values for drop shadows, however those are not strictly @@ -530,37 +355,24 @@ void R_DrawDropShadowColumn_8(void) dest = &topleft[dc_yl*vid.width + dc_x]; #define DSCOLOR 31 // palette index for the color of the shadow - - if (!dc_transmap) - { - while ((count -= 2) >= 0) - { - *dest = R_AlphaBlend_8(DSCOLOR, dc_alpha, dest); - dest += vid.width; - *dest = R_AlphaBlend_8(DSCOLOR, dc_alpha, dest); - dest += vid.width; - } - if (count & 1) - *dest = R_AlphaBlend_8(DSCOLOR, dc_alpha, dest); - } - else + while ((count -= 2) >= 0) { - register const UINT8 *transmap_offset = dc_transmap + (dc_colormap[DSCOLOR] << 8); - while ((count -= 2) >= 0) - { - *dest = *(transmap_offset + (*dest)); - dest += vid.width; - *dest = *(transmap_offset + (*dest)); - dest += vid.width; - } - if (count & 1) - *dest = *(transmap_offset + (*dest)); + *dest = R_AlphaBlend(DSCOLOR, dc_alpha, dest); + dest += vid.width; + *dest = R_AlphaBlend(DSCOLOR, dc_alpha, dest); + dest += vid.width; } - + if (count & 1) + *dest = R_AlphaBlend(DSCOLOR, dc_alpha, dest); #undef DSCOLOR } -void R_DrawAlphaColumn_8(void) +/** \brief The R_DrawTranslucentColumn_8 function + I've made an asm routine for the transparency, because it slows down + a lot in 640x480 with big sprites (bfg on all screen, or transparent + walls on fullscreen) +*/ +void R_DrawTranslucentColumn_8(void) { register INT32 count; register UINT8 *dest; @@ -608,7 +420,7 @@ void R_DrawAlphaColumn_8(void) // Re-map color indices from wall texture column // using a lighting/special effects LUT. // heightmask is the Tutti-Frutti fix - *dest = R_AlphaBlend_8(colormap[source[frac>>FRACBITS]], dc_alpha, dest); + *dest = R_AlphaBlend(colormap[source[frac>>FRACBITS]], dc_alpha, dest); dest += vid.width; if ((frac += fracstep) >= heightmask) frac -= heightmask; @@ -619,15 +431,15 @@ void R_DrawAlphaColumn_8(void) { while ((count -= 2) >= 0) // texture height is a power of 2 { - *dest = R_AlphaBlend_8(colormap[source[(frac>>FRACBITS)&heightmask]], dc_alpha, dest); + *dest = R_AlphaBlend(colormap[source[(frac>>FRACBITS)&heightmask]], dc_alpha, dest); dest += vid.width; frac += fracstep; - *dest = R_AlphaBlend_8(colormap[source[(frac>>FRACBITS)&heightmask]], dc_alpha, dest); + *dest = R_AlphaBlend(colormap[source[(frac>>FRACBITS)&heightmask]], dc_alpha, dest); dest += vid.width; frac += fracstep; } if (count & 1) - *dest = R_AlphaBlend_8(colormap[source[(frac>>FRACBITS)&heightmask]], dc_alpha, dest); + *dest = R_AlphaBlend(colormap[source[(frac>>FRACBITS)&heightmask]], dc_alpha, dest); } } } @@ -677,74 +489,7 @@ void R_DrawTranslatedTranslucentColumn_8(void) // Re-map color indices from wall texture column // using a lighting/special effects LUT. // heightmask is the Tutti-Frutti fix - - *dest = *(dc_transmap + (dc_colormap[dc_translation[dc_source[frac>>FRACBITS]]]<<8) + (*dest)); - - dest += vid.width; - if ((frac += fracstep) >= heightmask) - frac -= heightmask; - } - while (--count); - } - else - { - while ((count -= 2) >= 0) // texture height is a power of 2 - { - *dest = *(dc_transmap + (dc_colormap[dc_translation[dc_source[(frac>>FRACBITS)&heightmask]]]<<8) + (*dest)); - dest += vid.width; - frac += fracstep; - *dest = *(dc_transmap + (dc_colormap[dc_translation[dc_source[(frac>>FRACBITS)&heightmask]]]<<8) + (*dest)); - dest += vid.width; - frac += fracstep; - } - if (count & 1) - *dest = *(dc_transmap + (dc_colormap[dc_translation[dc_source[(frac>>FRACBITS)&heightmask]]]<<8) + (*dest)); - } - } -} - -void R_DrawTranslatedAlphaColumn_8(void) -{ - register INT32 count; - register UINT8 *dest; - register fixed_t frac, fracstep; - - count = dc_yh - dc_yl + 1; - - if (count <= 0) // Zero length, column does not exceed a pixel. - return; - - // FIXME. As above. - //dest = ylookup[dc_yl] + columnofs[dc_x]; - dest = &topleft[dc_yl*vid.width + dc_x]; - - // Looks familiar. - fracstep = dc_iscale; - //frac = dc_texturemid + (dc_yl - centery)*fracstep; - frac = (dc_texturemid + FixedMul((dc_yl << FRACBITS) - centeryfrac, fracstep))*(!dc_hires); - - // Inner loop that does the actual texture mapping, e.g. a DDA-like scaling. - // This is as fast as it gets. - { - register INT32 heightmask = dc_texheight - 1; - if (dc_texheight & heightmask) - { - heightmask++; - heightmask <<= FRACBITS; - - if (frac < 0) - while ((frac += heightmask) < 0) - ; - else - while (frac >= heightmask) - frac -= heightmask; - - do - { - // Re-map color indices from wall texture column - // using a lighting/special effects LUT. - // heightmask is the Tutti-Frutti fix - *dest = R_AlphaBlend_8(dc_colormap[dc_translation[dc_source[frac>>FRACBITS]]], dc_alpha, dest); + *dest = R_AlphaBlend(dc_colormap[dc_translation[dc_source[frac>>FRACBITS]]], dc_alpha, dest); dest += vid.width; if ((frac += fracstep) >= heightmask) frac -= heightmask; @@ -755,15 +500,15 @@ void R_DrawTranslatedAlphaColumn_8(void) { while ((count -= 2) >= 0) // texture height is a power of 2 { - *dest = R_AlphaBlend_8(dc_colormap[dc_translation[dc_source[(frac>>FRACBITS)&heightmask]]], dc_alpha, dest); + *dest = R_AlphaBlend(dc_colormap[dc_translation[dc_source[(frac>>FRACBITS)&heightmask]]], dc_alpha, dest); dest += vid.width; frac += fracstep; - *dest = R_AlphaBlend_8(dc_colormap[dc_translation[dc_source[(frac>>FRACBITS)&heightmask]]], dc_alpha, dest); + *dest = R_AlphaBlend(dc_colormap[dc_translation[dc_source[(frac>>FRACBITS)&heightmask]]], dc_alpha, dest); dest += vid.width; frac += fracstep; } if (count & 1) - *dest = R_AlphaBlend_8(dc_colormap[dc_translation[dc_source[(frac>>FRACBITS)&heightmask]]], dc_alpha, dest); + *dest = R_AlphaBlend(dc_colormap[dc_translation[dc_source[(frac>>FRACBITS)&heightmask]]], dc_alpha, dest); } } } @@ -850,56 +595,13 @@ void R_DrawSpan_8(void) colormap = ds_colormap; dest = ylookup[ds_y] + columnofs[ds_x1]; - if (dest+8 > deststop) - return; - - while (count >= 8) + while (count-- && dest <= deststop) { - // SoM: Why didn't I see this earlier? the spot variable is a waste now because we don't - // have the uber complicated math to calculate it now, so that was a memory write we didn't - // need! - dest[0] = colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]]; - xposition += xstep; - yposition += ystep; - - dest[1] = colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]]; - xposition += xstep; - yposition += ystep; - - dest[2] = colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]]; - xposition += xstep; - yposition += ystep; - - dest[3] = colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]]; + *dest++ = colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]]; xposition += xstep; yposition += ystep; - - dest[4] = colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]]; - xposition += xstep; - yposition += ystep; - - dest[5] = colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]]; - xposition += xstep; - yposition += ystep; - - dest[6] = colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]]; - xposition += xstep; - yposition += ystep; - - dest[7] = colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]]; - xposition += xstep; - yposition += ystep; - - dest += 8; - count -= 8; - } - while (count-- && dest <= deststop) - { - *dest++ = colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]]; - xposition += xstep; - yposition += ystep; - } -} + } +} /** \brief The R_DrawTiltedSpan_8 function Draw slopes! Holy sheit! @@ -1076,105 +778,7 @@ void R_DrawTiltedTranslucentSpan_8(void) for (i = SPANSIZE-1; i >= 0; i--) { colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); - *dest = *(ds_transmap + (colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]] << 8) + *dest); - dest++; - u += stepu; - v += stepv; - } - startu = endu; - startv = endv; - width -= SPANSIZE; - } - if (width > 0) - { - if (width == 1) - { - u = (INT64)(startu); - v = (INT64)(startv); - colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); - *dest = *(ds_transmap + (colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]] << 8) + *dest); - } - else - { - double left = width; - iz += ds_szp->x * left; - uz += ds_sup->x * left; - vz += ds_svp->x * left; - - endz = 1.f/iz; - endu = uz*endz; - endv = vz*endz; - left = 1.f/left; - stepu = (INT64)((endu - startu) * left); - stepv = (INT64)((endv - startv) * left); - u = (INT64)(startu); - v = (INT64)(startv); - - for (; width != 0; width--) - { - colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); - *dest = *(ds_transmap + (colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]] << 8) + *dest); - dest++; - u += stepu; - v += stepv; - } - } - } -} - -void R_DrawTiltedAlphaSpan_8(void) -{ - // x1, x2 = ds_x1, ds_x2 - int width = ds_x2 - ds_x1; - double iz, uz, vz; - UINT32 u, v; - int i; - - UINT8 *source; - UINT8 *colormap; - UINT8 *dest; - - double startz, startu, startv; - double izstep, uzstep, vzstep; - double endz, endu, endv; - UINT32 stepu, stepv; - - iz = ds_szp->z + ds_szp->y*(centery-ds_y) + ds_szp->x*(ds_x1-centerx); - uz = ds_sup->z + ds_sup->y*(centery-ds_y) + ds_sup->x*(ds_x1-centerx); - vz = ds_svp->z + ds_svp->y*(centery-ds_y) + ds_svp->x*(ds_x1-centerx); - - CALC_SLOPE_LIGHT - - dest = ylookup[ds_y] + columnofs[ds_x1]; - source = ds_source; - - startz = 1.f/iz; - startu = uz*startz; - startv = vz*startz; - - izstep = ds_szp->x * SPANSIZE; - uzstep = ds_sup->x * SPANSIZE; - vzstep = ds_svp->x * SPANSIZE; - width++; - - while (width >= SPANSIZE) - { - iz += izstep; - uz += uzstep; - vz += vzstep; - - endz = 1.f/iz; - endu = uz*endz; - endv = vz*endz; - stepu = (INT64)((endu - startu) * INVSPAN); - stepv = (INT64)((endv - startv) * INVSPAN); - u = (INT64)(startu); - v = (INT64)(startv); - - for (i = SPANSIZE-1; i >= 0; i--) - { - colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); - *dest = R_AlphaBlend_8(colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]], ds_alpha, dest); + *dest = R_AlphaBlend(colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]], ds_alpha, dest); dest++; u += stepu; v += stepv; @@ -1190,7 +794,7 @@ void R_DrawTiltedAlphaSpan_8(void) u = (INT64)(startu); v = (INT64)(startv); colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); - *dest = R_AlphaBlend_8(colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]], ds_alpha, dest); + *dest = R_AlphaBlend(colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]], ds_alpha, dest); } else { @@ -1211,7 +815,7 @@ void R_DrawTiltedAlphaSpan_8(void) for (; width != 0; width--) { colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); - *dest = R_AlphaBlend_8(colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]], ds_alpha, dest); + *dest = R_AlphaBlend(colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]], ds_alpha, dest); dest++; u += stepu; v += stepv; @@ -1260,106 +864,6 @@ void R_DrawTiltedWaterSpan_8(void) vzstep = ds_svp->x * SPANSIZE; width++; - while (width >= SPANSIZE) - { - iz += izstep; - uz += uzstep; - vz += vzstep; - - endz = 1.f/iz; - endu = uz*endz; - endv = vz*endz; - stepu = (INT64)((endu - startu) * INVSPAN); - stepv = (INT64)((endv - startv) * INVSPAN); - u = (INT64)(startu); - v = (INT64)(startv); - - for (i = SPANSIZE-1; i >= 0; i--) - { - colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); - *dest = *(ds_transmap + (colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]] << 8) + *dsrc++); - dest++; - u += stepu; - v += stepv; - } - startu = endu; - startv = endv; - width -= SPANSIZE; - } - if (width > 0) - { - if (width == 1) - { - u = (INT64)(startu); - v = (INT64)(startv); - colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); - *dest = *(ds_transmap + (colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]] << 8) + *dsrc++); - } - else - { - double left = width; - iz += ds_szp->x * left; - uz += ds_sup->x * left; - vz += ds_svp->x * left; - - endz = 1.f/iz; - endu = uz*endz; - endv = vz*endz; - left = 1.f/left; - stepu = (INT64)((endu - startu) * left); - stepv = (INT64)((endv - startv) * left); - u = (INT64)(startu); - v = (INT64)(startv); - - for (; width != 0; width--) - { - colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); - *dest = *(ds_transmap + (colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]] << 8) + *dsrc++); - dest++; - u += stepu; - v += stepv; - } - } - } -} - -void R_DrawTiltedAlphaWaterSpan_8(void) -{ - // x1, x2 = ds_x1, ds_x2 - int width = ds_x2 - ds_x1; - double iz, uz, vz; - UINT32 u, v; - int i; - - UINT8 *source; - UINT8 *colormap; - UINT8 *dest; - UINT8 *dsrc; - - double startz, startu, startv; - double izstep, uzstep, vzstep; - double endz, endu, endv; - UINT32 stepu, stepv; - - iz = ds_szp->z + ds_szp->y*(centery-ds_y) + ds_szp->x*(ds_x1-centerx); - uz = ds_sup->z + ds_sup->y*(centery-ds_y) + ds_sup->x*(ds_x1-centerx); - vz = ds_svp->z + ds_svp->y*(centery-ds_y) + ds_svp->x*(ds_x1-centerx); - - CALC_SLOPE_LIGHT - - dest = ylookup[ds_y] + columnofs[ds_x1]; - dsrc = screens[1] + (ds_y+ds_bgofs)*vid.width + ds_x1; - source = ds_source; - - startz = 1.f/iz; - startu = uz*startz; - startv = vz*startz; - - izstep = ds_szp->x * SPANSIZE; - uzstep = ds_sup->x * SPANSIZE; - vzstep = ds_svp->x * SPANSIZE; - width++; - while (width >= SPANSIZE) { iz += izstep; @@ -1563,81 +1067,6 @@ void R_DrawSplat_8(void) colormap = ds_colormap; dest = ylookup[ds_y] + columnofs[ds_x1]; - while (count >= 8) - { - // SoM: Why didn't I see this earlier? the spot variable is a waste now because we don't - // have the uber complicated math to calculate it now, so that was a memory write we didn't - // need! - // - // <Callum> 4194303 = (2048x2048)-1 (2048x2048 is maximum flat size) - // Why decimal? 0x3FFFFF == 4194303... ~Golden - val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val &= 0x3FFFFF; - val = source[val]; - if (val != TRANSPARENTPIXEL) - dest[0] = colormap[val]; - xposition += xstep; - yposition += ystep; - - val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val &= 0x3FFFFF; - val = source[val]; - if (val != TRANSPARENTPIXEL) - dest[1] = colormap[val]; - xposition += xstep; - yposition += ystep; - - val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val &= 0x3FFFFF; - val = source[val]; - if (val != TRANSPARENTPIXEL) - dest[2] = colormap[val]; - xposition += xstep; - yposition += ystep; - - val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val &= 0x3FFFFF; - val = source[val]; - if (val != TRANSPARENTPIXEL) - dest[3] = colormap[val]; - xposition += xstep; - yposition += ystep; - - val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val &= 0x3FFFFF; - val = source[val]; - if (val != TRANSPARENTPIXEL) - dest[4] = colormap[val]; - xposition += xstep; - yposition += ystep; - - val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val &= 0x3FFFFF; - val = source[val]; - if (val != TRANSPARENTPIXEL) - dest[5] = colormap[val]; - xposition += xstep; - yposition += ystep; - - val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val &= 0x3FFFFF; - val = source[val]; - if (val != TRANSPARENTPIXEL) - dest[6] = colormap[val]; - xposition += xstep; - yposition += ystep; - - val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val &= 0x3FFFFF; - val = source[val]; - if (val != TRANSPARENTPIXEL) - dest[7] = colormap[val]; - xposition += xstep; - yposition += ystep; - - dest += 8; - count -= 8; - } while (count-- && dest <= deststop) { val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; @@ -1683,166 +1112,12 @@ void R_DrawTranslucentSplat_8(void) colormap = ds_colormap; dest = ylookup[ds_y] + columnofs[ds_x1]; - while (count >= 8) + while (count-- && dest <= deststop) { - // SoM: Why didn't I see this earlier? the spot variable is a waste now because we don't - // have the uber complicated math to calculate it now, so that was a memory write we didn't - // need! val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; if (val != TRANSPARENTPIXEL) - dest[0] = *(ds_transmap + (colormap[val] << 8) + dest[0]); - xposition += xstep; - yposition += ystep; - - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val != TRANSPARENTPIXEL) - dest[1] = *(ds_transmap + (colormap[val] << 8) + dest[1]); - xposition += xstep; - yposition += ystep; - - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val != TRANSPARENTPIXEL) - dest[2] = *(ds_transmap + (colormap[val] << 8) + dest[2]); - xposition += xstep; - yposition += ystep; - - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val != TRANSPARENTPIXEL) - dest[3] = *(ds_transmap + (colormap[val] << 8) + dest[3]); - xposition += xstep; - yposition += ystep; - - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val != TRANSPARENTPIXEL) - dest[4] = *(ds_transmap + (colormap[val] << 8) + dest[4]); - xposition += xstep; - yposition += ystep; - - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val != TRANSPARENTPIXEL) - dest[5] = *(ds_transmap + (colormap[val] << 8) + dest[5]); - xposition += xstep; - yposition += ystep; - - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val != TRANSPARENTPIXEL) - dest[6] = *(ds_transmap + (colormap[val] << 8) + dest[6]); - xposition += xstep; - yposition += ystep; - - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val != TRANSPARENTPIXEL) - dest[7] = *(ds_transmap + (colormap[val] << 8) + dest[7]); - xposition += xstep; - yposition += ystep; - - dest += 8; - count -= 8; - } - while (count-- && dest <= deststop) - { - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val != TRANSPARENTPIXEL) - *dest = *(ds_transmap + (colormap[val] << 8) + *dest); - dest++; - xposition += xstep; - yposition += ystep; - } -} - -void R_DrawAlphaSplat_8(void) -{ - fixed_t xposition; - fixed_t yposition; - fixed_t xstep, ystep; - - UINT8 *source; - UINT8 *colormap; - UINT8 *dest; - const UINT8 *deststop = screens[0] + vid.rowbytes * vid.height; - - size_t count = (ds_x2 - ds_x1 + 1); - UINT32 val; - - xposition = ds_xfrac; yposition = ds_yfrac; - xstep = ds_xstep; ystep = ds_ystep; - - // SoM: we only need 6 bits for the integer part (0 thru 63) so the rest - // can be used for the fraction part. This allows calculation of the memory address in the - // texture with two shifts, an OR and one AND. (see below) - // for texture sizes > 64 the amount of precision we can allow will decrease, but only by one - // bit per power of two (obviously) - // Ok, because I was able to eliminate the variable spot below, this function is now FASTER - // than the original span renderer. Whodathunkit? - xposition <<= nflatshiftup; yposition <<= nflatshiftup; - xstep <<= nflatshiftup; ystep <<= nflatshiftup; - - source = ds_source; - colormap = ds_colormap; - dest = ylookup[ds_y] + columnofs[ds_x1]; - - while (count >= 8) - { - // SoM: Why didn't I see this earlier? the spot variable is a waste now because we don't - // have the uber complicated math to calculate it now, so that was a memory write we didn't - // need! - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val != TRANSPARENTPIXEL) - *dest = R_AlphaBlend_8(colormap[val], ds_alpha, dest + 0); - xposition += xstep; - yposition += ystep; - - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val != TRANSPARENTPIXEL) - *dest = R_AlphaBlend_8(colormap[val], ds_alpha, dest + 1); - xposition += xstep; - yposition += ystep; - - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val != TRANSPARENTPIXEL) - *dest = R_AlphaBlend_8(colormap[val], ds_alpha, dest + 2); - xposition += xstep; - yposition += ystep; - - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val != TRANSPARENTPIXEL) - *dest = R_AlphaBlend_8(colormap[val], ds_alpha, dest + 3); - xposition += xstep; - yposition += ystep; - - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val != TRANSPARENTPIXEL) - *dest = R_AlphaBlend_8(colormap[val], ds_alpha, dest + 4); - xposition += xstep; - yposition += ystep; - - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val != TRANSPARENTPIXEL) - *dest = R_AlphaBlend_8(colormap[val], ds_alpha, dest + 5); - xposition += xstep; - yposition += ystep; - - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val != TRANSPARENTPIXEL) - *dest = R_AlphaBlend_8(colormap[val], ds_alpha, dest + 6); - xposition += xstep; - yposition += ystep; - - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val != TRANSPARENTPIXEL) - *dest = R_AlphaBlend_8(colormap[val], ds_alpha, dest + 7); - xposition += xstep; - yposition += ystep; - - dest += 8; - count -= 8; - } - while (count-- && dest <= deststop) - { - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val != TRANSPARENTPIXEL) - *dest = R_AlphaBlend_8(colormap[val], ds_alpha, dest); - dest++; + *dest = R_AlphaBlend(colormap[val], ds_alpha, dest); + dest++; xposition += xstep; yposition += ystep; } @@ -1884,70 +1159,6 @@ void R_DrawFloorSprite_8(void) translation = ds_translation; dest = ylookup[ds_y] + columnofs[ds_x1]; - while (count >= 8) - { - // SoM: Why didn't I see this earlier? the spot variable is a waste now because we don't - // have the uber complicated math to calculate it now, so that was a memory write we didn't - // need! - val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val = source[val]; - if (val & 0xFF00) - dest[0] = colormap[translation[val & 0xFF]]; - xposition += xstep; - yposition += ystep; - - val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val = source[val]; - if (val & 0xFF00) - dest[1] = colormap[translation[val & 0xFF]]; - xposition += xstep; - yposition += ystep; - - val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val = source[val]; - if (val & 0xFF00) - dest[2] = colormap[translation[val & 0xFF]]; - xposition += xstep; - yposition += ystep; - - val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val = source[val]; - if (val & 0xFF00) - dest[3] = colormap[translation[val & 0xFF]]; - xposition += xstep; - yposition += ystep; - - val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val = source[val]; - if (val & 0xFF00) - dest[4] = colormap[translation[val & 0xFF]]; - xposition += xstep; - yposition += ystep; - - val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val = source[val]; - if (val & 0xFF00) - dest[5] = colormap[translation[val & 0xFF]]; - xposition += xstep; - yposition += ystep; - - val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val = source[val]; - if (val & 0xFF00) - dest[6] = colormap[translation[val & 0xFF]]; - xposition += xstep; - yposition += ystep; - - val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val = source[val]; - if (val & 0xFF00) - dest[7] = colormap[translation[val & 0xFF]]; - xposition += xstep; - yposition += ystep; - - dest += 8; - count -= 8; - } while (count-- && dest <= deststop) { val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; @@ -1964,316 +1175,52 @@ void R_DrawFloorSprite_8(void) */ void R_DrawTranslucentFloorSprite_8(void) { - fixed_t xposition; - fixed_t yposition; - fixed_t xstep, ystep; - - UINT16 *source; - UINT8 *colormap; - UINT8 *translation; - UINT8 *dest; - const UINT8 *deststop = screens[0] + vid.rowbytes * vid.height; - - size_t count = (ds_x2 - ds_x1 + 1); - UINT32 val; - - xposition = ds_xfrac; yposition = ds_yfrac; - xstep = ds_xstep; ystep = ds_ystep; - - // SoM: we only need 6 bits for the integer part (0 thru 63) so the rest - // can be used for the fraction part. This allows calculation of the memory address in the - // texture with two shifts, an OR and one AND. (see below) - // for texture sizes > 64 the amount of precision we can allow will decrease, but only by one - // bit per power of two (obviously) - // Ok, because I was able to eliminate the variable spot below, this function is now FASTER - // than the original span renderer. Whodathunkit? - xposition <<= nflatshiftup; yposition <<= nflatshiftup; - xstep <<= nflatshiftup; ystep <<= nflatshiftup; - - source = (UINT16 *)ds_source; - colormap = ds_colormap; - translation = ds_translation; - dest = ylookup[ds_y] + columnofs[ds_x1]; - - while (count >= 8) - { - // SoM: Why didn't I see this earlier? the spot variable is a waste now because we don't - // have the uber complicated math to calculate it now, so that was a memory write we didn't - // need! - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val & 0xFF00) - dest[0] = *(ds_transmap + (colormap[translation[val & 0xFF]] << 8) + dest[0]); - xposition += xstep; - yposition += ystep; - - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val & 0xFF00) - dest[1] = *(ds_transmap + (colormap[translation[val & 0xFF]] << 8) + dest[1]); - xposition += xstep; - yposition += ystep; - - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val & 0xFF00) - dest[2] = *(ds_transmap + (colormap[translation[val & 0xFF]] << 8) + dest[2]); - xposition += xstep; - yposition += ystep; - - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val & 0xFF00) - dest[3] = *(ds_transmap + (colormap[translation[val & 0xFF]] << 8) + dest[3]); - xposition += xstep; - yposition += ystep; - - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val & 0xFF00) - dest[4] = *(ds_transmap + (colormap[translation[val & 0xFF]] << 8) + dest[4]); - xposition += xstep; - yposition += ystep; - - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val & 0xFF00) - dest[5] = *(ds_transmap + (colormap[translation[val & 0xFF]] << 8) + dest[5]); - xposition += xstep; - yposition += ystep; - - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val & 0xFF00) - dest[6] = *(ds_transmap + (colormap[translation[val & 0xFF]] << 8) + dest[6]); - xposition += xstep; - yposition += ystep; - - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val & 0xFF00) - dest[7] = *(ds_transmap + (colormap[translation[val & 0xFF]] << 8) + dest[7]); - xposition += xstep; - yposition += ystep; - - dest += 8; - count -= 8; - } - while (count-- && dest <= deststop) - { - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val & 0xFF00) - *dest = *(ds_transmap + (colormap[translation[val & 0xFF]] << 8) + *dest); - dest++; - xposition += xstep; - yposition += ystep; - } -} - -void R_DrawAlphaFloorSprite_8(void) -{ - fixed_t xposition; - fixed_t yposition; - fixed_t xstep, ystep; - - UINT16 *source; - UINT8 *colormap; - UINT8 *translation; - UINT8 *dest; - const UINT8 *deststop = screens[0] + vid.rowbytes * vid.height; - - size_t count = (ds_x2 - ds_x1 + 1); - UINT32 val; - - xposition = ds_xfrac; yposition = ds_yfrac; - xstep = ds_xstep; ystep = ds_ystep; - - // SoM: we only need 6 bits for the integer part (0 thru 63) so the rest - // can be used for the fraction part. This allows calculation of the memory address in the - // texture with two shifts, an OR and one AND. (see below) - // for texture sizes > 64 the amount of precision we can allow will decrease, but only by one - // bit per power of two (obviously) - // Ok, because I was able to eliminate the variable spot below, this function is now FASTER - // than the original span renderer. Whodathunkit? - xposition <<= nflatshiftup; yposition <<= nflatshiftup; - xstep <<= nflatshiftup; ystep <<= nflatshiftup; - - source = (UINT16 *)ds_source; - colormap = ds_colormap; - translation = ds_translation; - dest = ylookup[ds_y] + columnofs[ds_x1]; - - while (count >= 8) - { - // SoM: Why didn't I see this earlier? the spot variable is a waste now because we don't - // have the uber complicated math to calculate it now, so that was a memory write we didn't - // need! - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val & 0xFF00) - *dest = R_AlphaBlend_8(colormap[translation[val & 0xFF]], ds_alpha, dest + 0); - xposition += xstep; - yposition += ystep; - - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val & 0xFF00) - *dest = R_AlphaBlend_8(colormap[translation[val & 0xFF]], ds_alpha, dest + 1); - xposition += xstep; - yposition += ystep; - - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val & 0xFF00) - *dest = R_AlphaBlend_8(colormap[translation[val & 0xFF]], ds_alpha, dest + 2); - xposition += xstep; - yposition += ystep; - - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val & 0xFF00) - *dest = R_AlphaBlend_8(colormap[translation[val & 0xFF]], ds_alpha, dest + 3); - xposition += xstep; - yposition += ystep; - - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val & 0xFF00) - *dest = R_AlphaBlend_8(colormap[translation[val & 0xFF]], ds_alpha, dest + 4); - xposition += xstep; - yposition += ystep; - - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val & 0xFF00) - *dest = R_AlphaBlend_8(colormap[translation[val & 0xFF]], ds_alpha, dest + 5); - xposition += xstep; - yposition += ystep; - - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val & 0xFF00) - *dest = R_AlphaBlend_8(colormap[translation[val & 0xFF]], ds_alpha, dest + 6); - xposition += xstep; - yposition += ystep; - - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val & 0xFF00) - *dest = R_AlphaBlend_8(colormap[translation[val & 0xFF]], ds_alpha, dest + 7); - xposition += xstep; - yposition += ystep; - - dest += 8; - count -= 8; - } - while (count-- && dest <= deststop) - { - val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; - if (val & 0xFF00) - *dest = R_AlphaBlend_8(colormap[translation[val & 0xFF]], ds_alpha, dest); - dest++; - xposition += xstep; - yposition += ystep; - } -} - -/** \brief The R_DrawTiltedFloorSprite_8 function - Draws a tilted floor sprite. -*/ -void R_DrawTiltedFloorSprite_8(void) -{ - // x1, x2 = ds_x1, ds_x2 - int width = ds_x2 - ds_x1; - double iz, uz, vz; - UINT32 u, v; - int i; - - UINT16 *source; - UINT8 *colormap; - UINT8 *translation; - UINT8 *dest; - UINT16 val; - - double startz, startu, startv; - double izstep, uzstep, vzstep; - double endz, endu, endv; - UINT32 stepu, stepv; - - iz = ds_szp->z + ds_szp->y*(centery-ds_y) + ds_szp->x*(ds_x1-centerx); - uz = ds_sup->z + ds_sup->y*(centery-ds_y) + ds_sup->x*(ds_x1-centerx); - vz = ds_svp->z + ds_svp->y*(centery-ds_y) + ds_svp->x*(ds_x1-centerx); - - dest = ylookup[ds_y] + columnofs[ds_x1]; - source = (UINT16 *)ds_source; - colormap = ds_colormap; - translation = ds_translation; - - startz = 1.f/iz; - startu = uz*startz; - startv = vz*startz; - - izstep = ds_szp->x * SPANSIZE; - uzstep = ds_sup->x * SPANSIZE; - vzstep = ds_svp->x * SPANSIZE; - width++; - - while (width >= SPANSIZE) - { - iz += izstep; - uz += uzstep; - vz += vzstep; - - endz = 1.f/iz; - endu = uz*endz; - endv = vz*endz; - stepu = (INT64)((endu - startu) * INVSPAN); - stepv = (INT64)((endv - startv) * INVSPAN); - u = (INT64)(startu); - v = (INT64)(startv); - - for (i = SPANSIZE-1; i >= 0; i--) - { - val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]; - if (val & 0xFF00) - *dest = colormap[translation[val & 0xFF]]; - dest++; - - u += stepu; - v += stepv; - } - startu = endu; - startv = endv; - width -= SPANSIZE; - } - if (width > 0) - { - if (width == 1) - { - u = (INT64)(startu); - v = (INT64)(startv); - val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]; - if (val & 0xFF00) - *dest = colormap[translation[val & 0xFF]]; - } - else - { - double left = width; - iz += ds_szp->x * left; - uz += ds_sup->x * left; - vz += ds_svp->x * left; + fixed_t xposition; + fixed_t yposition; + fixed_t xstep, ystep; - endz = 1.f/iz; - endu = uz*endz; - endv = vz*endz; - left = 1.f/left; - stepu = (INT64)((endu - startu) * left); - stepv = (INT64)((endv - startv) * left); - u = (INT64)(startu); - v = (INT64)(startv); + UINT16 *source; + UINT8 *colormap; + UINT8 *translation; + UINT8 *dest; + const UINT8 *deststop = screens[0] + vid.rowbytes * vid.height; - for (; width != 0; width--) - { - val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]; - if (val & 0xFF00) - *dest = colormap[translation[val & 0xFF]]; - dest++; + size_t count = (ds_x2 - ds_x1 + 1); + UINT32 val; - u += stepu; - v += stepv; - } - } + xposition = ds_xfrac; yposition = ds_yfrac; + xstep = ds_xstep; ystep = ds_ystep; + + // SoM: we only need 6 bits for the integer part (0 thru 63) so the rest + // can be used for the fraction part. This allows calculation of the memory address in the + // texture with two shifts, an OR and one AND. (see below) + // for texture sizes > 64 the amount of precision we can allow will decrease, but only by one + // bit per power of two (obviously) + // Ok, because I was able to eliminate the variable spot below, this function is now FASTER + // than the original span renderer. Whodathunkit? + xposition <<= nflatshiftup; yposition <<= nflatshiftup; + xstep <<= nflatshiftup; ystep <<= nflatshiftup; + + source = (UINT16 *)ds_source; + colormap = ds_colormap; + translation = ds_translation; + dest = ylookup[ds_y] + columnofs[ds_x1]; + + while (count-- && dest <= deststop) + { + val = source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]; + if (val & 0xFF00) + *dest = R_AlphaBlend(colormap[translation[val & 0xFF]], ds_alpha, dest); + dest++; + xposition += xstep; + yposition += ystep; } } -/** \brief The R_DrawTiltedTranslucentFloorSprite_8 function - Draws a tilted, translucent, floor sprite. +/** \brief The R_DrawTiltedFloorSprite_8 function + Draws a tilted floor sprite. */ -void R_DrawTiltedTranslucentFloorSprite_8(void) +void R_DrawTiltedFloorSprite_8(void) { // x1, x2 = ds_x1, ds_x2 int width = ds_x2 - ds_x1; @@ -2328,7 +1275,7 @@ void R_DrawTiltedTranslucentFloorSprite_8(void) { val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]; if (val & 0xFF00) - *dest = *(ds_transmap + (colormap[translation[val & 0xFF]] << 8) + *dest); + *dest = colormap[translation[val & 0xFF]]; dest++; u += stepu; @@ -2346,7 +1293,7 @@ void R_DrawTiltedTranslucentFloorSprite_8(void) v = (INT64)(startv); val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]; if (val & 0xFF00) - *dest = *(ds_transmap + (colormap[translation[val & 0xFF]] << 8) + *dest); + *dest = colormap[translation[val & 0xFF]]; } else { @@ -2368,7 +1315,7 @@ void R_DrawTiltedTranslucentFloorSprite_8(void) { val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]; if (val & 0xFF00) - *dest = *(ds_transmap + (colormap[translation[val & 0xFF]] << 8) + *dest); + *dest = colormap[translation[val & 0xFF]]; dest++; u += stepu; @@ -2378,7 +1325,10 @@ void R_DrawTiltedTranslucentFloorSprite_8(void) } } -void R_DrawTiltedAlphaFloorSprite_8(void) +/** \brief The R_DrawTiltedTranslucentFloorSprite_8 function + Draws a tilted, translucent, floor sprite. +*/ +void R_DrawTiltedTranslucentFloorSprite_8(void) { // x1, x2 = ds_x1, ds_x2 int width = ds_x2 - ds_x1; @@ -2433,7 +1383,7 @@ void R_DrawTiltedAlphaFloorSprite_8(void) { val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]; if (val & 0xFF00) - *dest = R_AlphaBlend_8(colormap[translation[val & 0xFF]], ds_alpha, dest); + *dest = R_AlphaBlend(colormap[translation[val & 0xFF]], ds_alpha, dest); dest++; u += stepu; @@ -2451,7 +1401,7 @@ void R_DrawTiltedAlphaFloorSprite_8(void) v = (INT64)(startv); val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]; if (val & 0xFF00) - *dest = R_AlphaBlend_8(colormap[translation[val & 0xFF]], ds_alpha, dest); + *dest = R_AlphaBlend(colormap[translation[val & 0xFF]], ds_alpha, dest); } else { @@ -2473,7 +1423,7 @@ void R_DrawTiltedAlphaFloorSprite_8(void) { val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]; if (val & 0xFF00) - *dest = R_AlphaBlend_8(colormap[translation[val & 0xFF]], ds_alpha, dest); + *dest = R_AlphaBlend(colormap[translation[val & 0xFF]], ds_alpha, dest); dest++; u += stepu; @@ -2517,131 +1467,10 @@ void R_DrawTranslucentSpan_8(void) colormap = ds_colormap; dest = ylookup[ds_y] + columnofs[ds_x1]; - while (count >= 8) - { - // SoM: Why didn't I see this earlier? the spot variable is a waste now because we don't - // have the uber complicated math to calculate it now, so that was a memory write we didn't - // need! - dest[0] = *(ds_transmap + (colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]] << 8) + dest[0]); - xposition += xstep; - yposition += ystep; - - dest[1] = *(ds_transmap + (colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]] << 8) + dest[1]); - xposition += xstep; - yposition += ystep; - - dest[2] = *(ds_transmap + (colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]] << 8) + dest[2]); - xposition += xstep; - yposition += ystep; - - dest[3] = *(ds_transmap + (colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]] << 8) + dest[3]); - xposition += xstep; - yposition += ystep; - - dest[4] = *(ds_transmap + (colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]] << 8) + dest[4]); - xposition += xstep; - yposition += ystep; - - dest[5] = *(ds_transmap + (colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]] << 8) + dest[5]); - xposition += xstep; - yposition += ystep; - - dest[6] = *(ds_transmap + (colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]] << 8) + dest[6]); - xposition += xstep; - yposition += ystep; - - dest[7] = *(ds_transmap + (colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]] << 8) + dest[7]); - xposition += xstep; - yposition += ystep; - - dest += 8; - count -= 8; - } - while (count-- && dest <= deststop) - { - val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - *dest = *(ds_transmap + (colormap[source[val]] << 8) + *dest); - dest++; - xposition += xstep; - yposition += ystep; - } -} - -void R_DrawAlphaSpan_8(void) -{ - fixed_t xposition; - fixed_t yposition; - fixed_t xstep, ystep; - - UINT8 *source; - UINT8 *colormap; - UINT8 *dest; - const UINT8 *deststop = screens[0] + vid.rowbytes * vid.height; - - size_t count = (ds_x2 - ds_x1 + 1); - UINT32 val; - - xposition = ds_xfrac; yposition = ds_yfrac; - xstep = ds_xstep; ystep = ds_ystep; - - // SoM: we only need 6 bits for the integer part (0 thru 63) so the rest - // can be used for the fraction part. This allows calculation of the memory address in the - // texture with two shifts, an OR and one AND. (see below) - // for texture sizes > 64 the amount of precision we can allow will decrease, but only by one - // bit per power of two (obviously) - // Ok, because I was able to eliminate the variable spot below, this function is now FASTER - // than the original span renderer. Whodathunkit? - xposition <<= nflatshiftup; yposition <<= nflatshiftup; - xstep <<= nflatshiftup; ystep <<= nflatshiftup; - - source = ds_source; - colormap = ds_colormap; - dest = ylookup[ds_y] + columnofs[ds_x1]; - - while (count >= 8) - { - // SoM: Why didn't I see this earlier? the spot variable is a waste now because we don't - // have the uber complicated math to calculate it now, so that was a memory write we didn't - // need! - *dest = R_AlphaBlend_8(colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]], ds_alpha, dest + 0); - xposition += xstep; - yposition += ystep; - - *dest = R_AlphaBlend_8(colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]], ds_alpha, dest + 1); - xposition += xstep; - yposition += ystep; - - *dest = R_AlphaBlend_8(colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]], ds_alpha, dest + 2); - xposition += xstep; - yposition += ystep; - - *dest = R_AlphaBlend_8(colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]], ds_alpha, dest + 3); - xposition += xstep; - yposition += ystep; - - *dest = R_AlphaBlend_8(colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]], ds_alpha, dest + 4); - xposition += xstep; - yposition += ystep; - - *dest = R_AlphaBlend_8(colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]], ds_alpha, dest + 5); - xposition += xstep; - yposition += ystep; - - *dest = R_AlphaBlend_8(colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]], ds_alpha, dest + 6); - xposition += xstep; - yposition += ystep; - - *dest = R_AlphaBlend_8(colormap[source[(((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift)]], ds_alpha, dest + 7); - xposition += xstep; - yposition += ystep; - - dest += 8; - count -= 8; - } while (count-- && dest <= deststop) { val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - *dest = R_AlphaBlend_8(colormap[source[val]], ds_alpha, dest); + *dest = R_AlphaBlend(colormap[source[val]], ds_alpha, dest); dest++; xposition += xstep; yposition += ystep; @@ -2677,123 +1506,6 @@ void R_DrawWaterSpan_8(void) dsrc = screens[1] + (ds_y+ds_bgofs)*vid.width + ds_x1; count = ds_x2 - ds_x1 + 1; - while (count >= 8) - { - // SoM: Why didn't I see this earlier? the spot variable is a waste now because we don't - // have the uber complicated math to calculate it now, so that was a memory write we didn't - // need! - dest[0] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + *dsrc++)]; - xposition += xstep; - yposition += ystep; - - dest[1] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + *dsrc++)]; - xposition += xstep; - yposition += ystep; - - dest[2] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + *dsrc++)]; - xposition += xstep; - yposition += ystep; - - dest[3] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + *dsrc++)]; - xposition += xstep; - yposition += ystep; - - dest[4] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + *dsrc++)]; - xposition += xstep; - yposition += ystep; - - dest[5] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + *dsrc++)]; - xposition += xstep; - yposition += ystep; - - dest[6] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + *dsrc++)]; - xposition += xstep; - yposition += ystep; - - dest[7] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + *dsrc++)]; - xposition += xstep; - yposition += ystep; - - dest += 8; - count -= 8; - } - while (count--) - { - *dest++ = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + *dsrc++)]; - xposition += xstep; - yposition += ystep; - } -} - -void R_DrawAlphaWaterSpan_8(void) -{ - UINT32 xposition; - UINT32 yposition; - UINT32 xstep, ystep; - - UINT8 *source; - UINT8 *colormap; - UINT8 *dest; - UINT8 *dsrc; - - size_t count; - - // SoM: we only need 6 bits for the integer part (0 thru 63) so the rest - // can be used for the fraction part. This allows calculation of the memory address in the - // texture with two shifts, an OR and one AND. (see below) - // for texture sizes > 64 the amount of precision we can allow will decrease, but only by one - // bit per power of two (obviously) - // Ok, because I was able to eliminate the variable spot below, this function is now FASTER - // than the original span renderer. Whodathunkit? - xposition = ds_xfrac << nflatshiftup; yposition = (ds_yfrac + ds_waterofs) << nflatshiftup; - xstep = ds_xstep << nflatshiftup; ystep = ds_ystep << nflatshiftup; - - source = ds_source; - colormap = ds_colormap; - dest = ylookup[ds_y] + columnofs[ds_x1]; - dsrc = screens[1] + (ds_y+ds_bgofs)*vid.width + ds_x1; - count = ds_x2 - ds_x1 + 1; - - while (count >= 8) - { - // SoM: Why didn't I see this earlier? the spot variable is a waste now because we don't - // have the uber complicated math to calculate it now, so that was a memory write we didn't - // need! - dest[0] = colormap[R_AlphaBlend_s8d8(source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)], ds_alpha, *dsrc++)]; - xposition += xstep; - yposition += ystep; - - dest[1] = colormap[R_AlphaBlend_s8d8(source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)], ds_alpha, *dsrc++)]; - xposition += xstep; - yposition += ystep; - - dest[2] = colormap[R_AlphaBlend_s8d8(source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)], ds_alpha, *dsrc++)]; - xposition += xstep; - yposition += ystep; - - dest[3] = colormap[R_AlphaBlend_s8d8(source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)], ds_alpha, *dsrc++)]; - xposition += xstep; - yposition += ystep; - - dest[4] = colormap[R_AlphaBlend_s8d8(source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)], ds_alpha, *dsrc++)]; - xposition += xstep; - yposition += ystep; - - dest[5] = colormap[R_AlphaBlend_s8d8(source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)], ds_alpha, *dsrc++)]; - xposition += xstep; - yposition += ystep; - - dest[6] = colormap[R_AlphaBlend_s8d8(source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)], ds_alpha, *dsrc++)]; - xposition += xstep; - yposition += ystep; - - dest[7] = colormap[R_AlphaBlend_s8d8(source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)], ds_alpha, *dsrc++)]; - xposition += xstep; - yposition += ystep; - - dest += 8; - count -= 8; - } while (count--) { *dest++ = colormap[R_AlphaBlend_s8d8(source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)], ds_alpha, *dsrc++)]; @@ -2873,7 +1585,7 @@ void R_DrawSolidColorSpan_8(void) /** \brief The R_DrawTransSolidColorSpan_8 function Draws a translucent solid color span. */ -void R_DrawTransSolidColorSpan_8(void) +void R_DrawTranslucentSolidColorSpan_8(void) { size_t count = (ds_x2 - ds_x1 + 1); @@ -2884,16 +1596,12 @@ void R_DrawTransSolidColorSpan_8(void) while (count-- && dest <= deststop) { - *dest = *(ds_transmap + (source << 8) + *dest); + // TODO + // *dest = *(ds_transmap + (source << 8) + *dest); dest++; } } -void R_DrawAlphaSolidColorSpan_8(void) -{ - // TODO -} - /** \brief The R_DrawTiltedSolidColorSpan_8 function Draws a tilted solid color span. */ @@ -2918,7 +1626,7 @@ void R_DrawTiltedSolidColorSpan_8(void) /** \brief The R_DrawTiltedTransSolidColorSpan_8 function Draws a tilted and translucent solid color span. */ -void R_DrawTiltedTransSolidColorSpan_8(void) +void R_DrawTiltedTranslucentSolidColorSpan_8(void) { int width = ds_x2 - ds_x1; @@ -2932,7 +1640,8 @@ void R_DrawTiltedTransSolidColorSpan_8(void) do { UINT8 *colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); - *dest = *(ds_transmap + (colormap[source] << 8) + *dest); + // *dest = *(ds_transmap + (colormap[source] << 8) + *dest); + // TODO dest++; } while (--width >= 0); } @@ -2975,25 +1684,11 @@ void R_DrawTiltedWaterSolidColorSpan_8(void) do { UINT8 *colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); - *dest++ = *(ds_transmap + (colormap[source] << 8) + *dsrc++); + // *dest++ = *(ds_transmap + (colormap[source] << 8) + *dsrc++); + // TODO } while (--width >= 0); } -void R_DrawAlphaWaterSolidColorSpan_8(void) -{ - // TODO -} - -void R_DrawTiltedAlphaSolidColorSpan_8(void) -{ - // TODO -} - -void R_DrawTiltedAlphaWaterSolidColorSpan_8(void) -{ - // TODO -} - /** \brief The R_DrawFogColumn_8 function Fog wall. */ diff --git a/src/r_draw8_npo2.c b/src/r_draw8_npo2.c index d0b3843d1f7bf670bf6532b51b4440e7dfacf61e..93d755efe8a66d95919575c1e13177b4080429ca 100644 --- a/src/r_draw8_npo2.c +++ b/src/r_draw8_npo2.c @@ -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 -} diff --git a/src/r_plane.c b/src/r_plane.c index 751fd95dc030181da5d37cabeb5fc9fbdaf7e73f..04928472d4afa48e97eb94b1eefa6377f6f5d52f 100644 --- a/src/r_plane.c +++ b/src/r_plane.c @@ -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) diff --git a/src/r_segs.c b/src/r_segs.c index 4b784b4ea9b66bcc9d138393294dc05139fbcc9e..25d17b17e3d6e78aadbc11093c353f091ef3f5c5 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -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) diff --git a/src/r_splats.c b/src/r_splats.c index 63931f14a0822d747a236921a425f758d1c11f09..e76c85dd16c3adbbbdb90144048708f9f7ddcc28 100644 --- a/src/r_splats.c +++ b/src/r_splats.c @@ -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) diff --git a/src/r_things.c b/src/r_things.c index 30da91e94a89b9645a16adf7500babe2f16bba6b..a23a81fae757f94b7ed067e60d97eed86efa2af0 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -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) { diff --git a/src/screen.c b/src/screen.c index d1092f12462ea0830c36ad63b93bc85af2c0ba42..0ee3ff2df81ae85b06f3c76fe345f9cd080c6280 100644 --- a/src/screen.c +++ b/src/screen.c @@ -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) diff --git a/src/screen.h b/src/screen.h index 962fcee26763f2776c7440c33f15a7bc4dbc3f74..1eab0670a40f8180d4ef8a566fecc8fc866a835e 100644 --- a/src/screen.h +++ b/src/screen.h @@ -121,14 +121,16 @@ extern vmode_t specialmodes[NUMSPECIALMODES]; enum { COLUMN_BASE = BASEDRAWFUNC, - COLUMN_TRANSTAB, COLUMN_ALPHA, - COLUMN_TRANSLATED, - COLUMN_SHADE, - COLUMN_LIGHTLIST, - COLUMN_MAPPED_TRANSTAB, COLUMN_MAPPED_ALPHA, + COLUMN_MAPPED, + COLUMN_TRANSLUCENT, + COLUMN_MAPPED_TRANSLUCENT, + COLUMN_MULTIPATCH, - COLUMN_MULTIPATCH_TRANSTAB, COLUMN_MULTIPATCH_ALPHA, + COLUMN_MULTIPATCH_TRANSLUCENT, + COLUMN_FOG, + COLUMN_SHADE, + COLUMN_LIGHTLIST, 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 // -----