Slightly unrelated, but if R_DrawTranslucentSplat_8 is ever going to be used this is probably more efficient (also fixing early colormap application for the last part)

This commit is contained in:
Monster Iestyn 2016-07-17 23:01:07 +01:00
parent 9ad205f5ba
commit 77a40e9016

View file

@ -874,9 +874,9 @@ void R_DrawTiltedSplat_8(void)
colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps);
val = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]]; val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)];
if (val != TRANSPARENTPIXEL) if (val != TRANSPARENTPIXEL)
*dest = val; *dest = colormap[val];
dest++; dest++;
iz += ds_sz.x; iz += ds_sz.x;
uz += ds_su.x; uz += ds_su.x;
@ -1124,49 +1124,49 @@ void R_DrawTranslucentSplat_8 (void)
// need! // need!
val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]; val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)];
if (val != TRANSPARENTPIXEL) if (val != TRANSPARENTPIXEL)
dest[0] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + dest[0])]; dest[0] = colormap[*(ds_transmap + (val << 8) + dest[0])];
xposition += xstep; xposition += xstep;
yposition += ystep; yposition += ystep;
val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]; val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)];
if (val != TRANSPARENTPIXEL) if (val != TRANSPARENTPIXEL)
dest[1] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + dest[1])]; dest[1] = colormap[*(ds_transmap + (val << 8) + dest[1])];
xposition += xstep; xposition += xstep;
yposition += ystep; yposition += ystep;
val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]; val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)];
if (val != TRANSPARENTPIXEL) if (val != TRANSPARENTPIXEL)
dest[2] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + dest[2])]; dest[2] = colormap[*(ds_transmap + (val << 8) + dest[2])];
xposition += xstep; xposition += xstep;
yposition += ystep; yposition += ystep;
val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]; val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)];
if (val != TRANSPARENTPIXEL) if (val != TRANSPARENTPIXEL)
dest[3] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + dest[3])]; dest[3] = colormap[*(ds_transmap + (val << 8) + dest[3])];
xposition += xstep; xposition += xstep;
yposition += ystep; yposition += ystep;
val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]; val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)];
if (val != TRANSPARENTPIXEL) if (val != TRANSPARENTPIXEL)
dest[4] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + dest[4])]; dest[4] = colormap[*(ds_transmap + (val << 8) + dest[4])];
xposition += xstep; xposition += xstep;
yposition += ystep; yposition += ystep;
val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]; val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)];
if (val != TRANSPARENTPIXEL) if (val != TRANSPARENTPIXEL)
dest[5] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + dest[5])]; dest[5] = colormap[*(ds_transmap + (val << 8) + dest[5])];
xposition += xstep; xposition += xstep;
yposition += ystep; yposition += ystep;
val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]; val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)];
if (val != TRANSPARENTPIXEL) if (val != TRANSPARENTPIXEL)
dest[6] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + dest[6])]; dest[6] = colormap[*(ds_transmap + (val << 8) + dest[6])];
xposition += xstep; xposition += xstep;
yposition += ystep; yposition += ystep;
val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]; val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)];
if (val != TRANSPARENTPIXEL) if (val != TRANSPARENTPIXEL)
dest[7] = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + dest[7])]; dest[7] = colormap[*(ds_transmap + (val << 8) + dest[7])];
xposition += xstep; xposition += xstep;
yposition += ystep; yposition += ystep;
@ -1175,9 +1175,9 @@ void R_DrawTranslucentSplat_8 (void)
} }
while (count--) while (count--)
{ {
val =colormap[source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)]]; val = source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)];
if (val != TRANSPARENTPIXEL) if (val != TRANSPARENTPIXEL)
*dest = colormap[*(ds_transmap + (source[((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)] << 8) + *dest)]; *dest = colormap[*(ds_transmap + (val << 8) + *dest)];
dest++; dest++;
xposition += xstep; xposition += xstep;