doomhack / GBADoom

A port of prBoom to the Nintendo GBA.
182 stars 25 forks source link

Saturn Style Enemy Transparency #25

Open RetroGamer02 opened 2 years ago

RetroGamer02 commented 2 years ago

Hi I added FastDoom's Saturn Fuzz effect to my fork and I was wondering if you would like it for GBADoom. I however have no idea how to do a merge request for just a snip-it of code so Ill post it here.

SaturnStyle Transparency Progress 2

//Code adapted from viti95's FastDoom to the GBA void R_DrawFuzzColumnSaturn(const draw_column_vars_t *dcvars) { int dc_yl = dcvars->yl; int dc_yh = dcvars->yh;

int count;
byte *dest;
fixed_t frac;
fixed_t fracstep;
int initialdrawpos = 0;

// Adjust borders. Low...
if (dc_yl <= 0)
    dc_yl = 1;

// .. and high.
if (dc_yh >= viewheight-1)
    dc_yh = viewheight - 2;

count = IDiv32((dc_yh - dc_yl), 2) - 1;

// Zero length, column does not exceed a pixel.
if (count <= 0)
    return;

const byte* colormap = &fullcolormap[6*256];

initialdrawpos = dc_yl + dcvars->x;

dest = drawvars.byte_topleft + ScreenYToOffset(dcvars->yl) + dcvars->x;

fracstep = (dcvars->iscale << COLEXTRABITS);
frac = (dcvars->texturemid + (dc_yl - centery)*dcvars->iscale) << COLEXTRABITS;

if (initialdrawpos & 1)
{
    dest += SCREENWIDTH * 2;
    frac += fracstep;
}

fracstep = 2 * (fracstep);

do
{
    *dest = colormap[dcvars->source[frac>>COLBITS]];

    dest += SCREENWIDTH * 4;
    frac += fracstep;
} while (count--);

if ((dc_yh - dc_yl) & 1)
{
    *dest = colormap[dcvars->source[(frac >> COLBITS)]];
}
else
{
    if (!(initialdrawpos & 1))
    {
        *dest = colormap[dcvars->source[(frac >> COLBITS)]];
    }
}

}

Kippykip commented 2 years ago

Heh, a while ago I did a PSXDoom GBA test, it would probably be a cool effect for that if a full version was to ever come out of it.