Revamp alpha setup for water FOFs

This commit is contained in:
MascaraSnake 2020-06-12 09:00:06 +02:00
parent 8dd3c78b05
commit 1ad8f75538
4 changed files with 39 additions and 30 deletions

View file

@ -1794,17 +1794,22 @@ udmf
type = 13;
}
arg1
{
title = "Alpha";
default = 128;
}
arg2
{
title = "Flags";
type = 12;
enum
{
1 = "Opaque";
2 = "Don't render sides";
4 = "Render separate light level";
8 = "Use target light level";
16 = "No ripple effect";
32 = "Goo physics";
1 = "Don't render sides";
2 = "Render separate light level";
4 = "Use target light level";
8 = "No ripple effect";
16 = "Goo physics";
32 = "Cut cyan flat pixels";
}
}
}

View file

@ -3056,32 +3056,36 @@ static void P_ConvertBinaryMap(void)
case 125: //FOF: goo water, translucent, no sides
lines[i].args[0] = lines[i].tag;
//Opaque?
//Alpha
if (lines[i].special == 120 || lines[i].special == 122)
lines[i].args[1] |= TMFW_OPAQUE;
lines[i].args[1] = 255;
else
{
if (sides[lines[i].sidenum[0]].toptexture > 0)
lines[i].alpha = (sides[lines[i].sidenum[0]].toptexture << FRACBITS)/255;
lines[i].args[1] = sides[lines[i].sidenum[0]].toptexture;
else
lines[i].alpha = FRACUNIT/2;
lines[i].args[1] = 128;
}
//No sides?
if (lines[i].special == 122 || lines[i].special == 123 || lines[i].special == 125)
lines[i].args[1] |= TMFW_NOSIDES;
lines[i].args[2] |= TMFW_NOSIDES;
//Flags
if (lines[i].flags & ML_NOCLIMB)
lines[i].args[1] |= TMFW_DOUBLESHADOW;
lines[i].args[2] |= TMFW_DOUBLESHADOW;
if (lines[i].flags & ML_EFFECT4)
lines[i].args[1] |= TMFW_COLORMAPONLY;
lines[i].args[2] |= TMFW_COLORMAPONLY;
if (!(lines[i].flags & ML_EFFECT5))
lines[i].args[1] |= TMFW_NORIPPLE;
lines[i].args[2] |= TMFW_NORIPPLE;
//Goo?
if (lines[i].special >= 124)
lines[i].args[1] |= TMFW_GOOWATER;
lines[i].args[2] |= TMFW_GOOWATER;
//Splat rendering?
if (lines[i].flags & ML_EFFECT6)
lines[i].args[2] |= TMFW_SPLAT;
lines[i].special = 120;
break;

View file

@ -5747,7 +5747,7 @@ static ffloor_t *P_AddFakeFloor(sector_t *sec, sector_t *sec2, line_t *master, I
}
fflr->alpha = max(0, min(0xff, alpha));
if (fflr->alpha == 0xff)
if (fflr->alpha < 0xff)
{
fflr->flags |= FF_TRANSLUCENT;
fflr->spawnflags = fflr->flags;
@ -6646,19 +6646,19 @@ void P_SpawnSpecials(boolean fromnetsave)
case 120: // FOF (water)
ffloorflags = FF_EXISTS|FF_RENDERPLANES|FF_SWIMMABLE|FF_BOTHPLANES|FF_CUTEXTRA|FF_EXTRA|FF_CUTSPRITES;
if (!(lines[i].args[1] & TMFW_OPAQUE))
ffloorflags |= FF_TRANSLUCENT;
if (!(lines[i].args[1] & TMFW_NOSIDES))
if (!(lines[i].args[2] & TMFW_NOSIDES))
ffloorflags |= FF_RENDERSIDES|FF_ALLSIDES;
if (lines[i].args[1] & TMFW_DOUBLESHADOW)
if (lines[i].args[2] & TMFW_DOUBLESHADOW)
ffloorflags |= FF_DOUBLESHADOW;
if (lines[i].args[1] & TMFW_COLORMAPONLY)
if (lines[i].args[2] & TMFW_COLORMAPONLY)
ffloorflags |= FF_COLORMAPONLY;
if (!(lines[i].args[1] & TMFW_NORIPPLE))
if (!(lines[i].args[2] & TMFW_NORIPPLE))
ffloorflags |= FF_RIPPLE;
if (lines[i].args[1] & TMFW_GOOWATER)
if (lines[i].args[2] & TMFW_GOOWATER)
ffloorflags |= FF_GOOWATER;
P_AddFakeFloorsByLine(i, (ffloorflags & FF_TRANSLUCENT) ? (lines[i].alpha * 0xff) >> FRACBITS : 0xff, ffloorflags, secthinkers);
if (lines[i].args[2] & TMFW_SPLAT)
ffloorflags |= FF_SPLAT;
P_AddFakeFloorsByLine(i, lines[i].args[1], ffloorflags, secthinkers);
break;
case 150: // FOF (Air bobbing)

View file

@ -46,12 +46,12 @@ typedef enum
typedef enum
{
TMFW_OPAQUE = 1,
TMFW_NOSIDES = 1<<1,
TMFW_DOUBLESHADOW = 1<<2,
TMFW_COLORMAPONLY = 1<<3,
TMFW_NORIPPLE = 1<<4,
TMFW_GOOWATER = 1<<5,
TMFW_NOSIDES = 1,
TMFW_DOUBLESHADOW = 1<<1,
TMFW_COLORMAPONLY = 1<<2,
TMFW_NORIPPLE = 1<<3,
TMFW_GOOWATER = 1<<4,
TMFW_SPLAT = 1<<5,
} textmapfofwater_t;
typedef enum