Revamp alpha setup for custom FOFs

This commit is contained in:
MascaraSnake 2020-06-12 09:57:56 +02:00
parent ac549eddeb
commit d6a104f8a5
3 changed files with 19 additions and 11 deletions

View file

@ -2163,6 +2163,11 @@ udmf
type = 13;
}
arg1
{
title = "Alpha";
default = 255;
}
arg2
{
title = "Flags";
type = 12;
@ -2180,7 +2185,6 @@ udmf
512 = "Split sprites";
1024 = "Render inside planes";
2048 = "Extra";
4096 = "Translucent";
8192 = "Fog";
16384 = "Only render inside planes";
32768 = "Render inside walls";

View file

@ -3381,15 +3381,19 @@ static void P_ConvertBinaryMap(void)
I_Error("Custom FOF (tag %d) found without a linedef back side!", lines[i].tag);
lines[i].args[0] = lines[i].tag;
lines[i].args[1] = sides[lines[i].sidenum[1]].toptexture;
lines[i].args[2] = sides[lines[i].sidenum[1]].midtexture;
if (lines[i].args[1] & FF_TRANSLUCENT)
lines[i].args[2] = sides[lines[i].sidenum[1]].toptexture;
if (lines[i].flags & ML_EFFECT6)
lines[i].args[2] |= FF_SPLAT;
lines[i].args[3] = sides[lines[i].sidenum[1]].midtexture;
if (lines[i].args[2] & FF_TRANSLUCENT)
{
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;
}
else
lines[i].args[1] = 255;
break;
case 443: //Call Lua function
if (lines[i].text)

View file

@ -6934,17 +6934,17 @@ void P_SpawnSpecials(boolean fromnetsave)
case 259: // Custom FOF
for (s = -1; (s = P_FindSectorFromTag(lines[i].args[0], s)) >= 0 ;)
{
ffloor_t *fflr = P_AddFakeFloor(&sectors[s], lines[i].frontsector, lines + i, (lines[i].args[1] & FF_TRANSLUCENT) ? (lines[i].alpha * 0xff) >> FRACBITS : 0xff, lines[i].args[1], secthinkers);
ffloor_t *fflr = P_AddFakeFloor(&sectors[s], lines[i].frontsector, lines + i, lines[i].args[1], lines[i].args[2], secthinkers);
if (!udmf) // Ugly backwards compatibility stuff
{
if (lines[i].args[1] & FF_QUICKSAND)
if (lines[i].args[2] & FF_QUICKSAND)
{
fflr->sinkspeed = abs(lines[i].dx) >> 1;
fflr->friction = abs(lines[i].dy) >> 6;
}
if (lines[i].args[1] & FF_BUSTUP)
if (lines[i].args[2] & FF_BUSTUP)
{
switch (lines[i].args[2] % TMFB_ONLYBOTTOM)
switch (lines[i].args[3] % TMFB_ONLYBOTTOM)
{
case TMFB_TOUCH:
fflr->busttype = BT_TOUCH;
@ -6960,7 +6960,7 @@ void P_SpawnSpecials(boolean fromnetsave)
break;
}
if (lines[i].args[2] & TMFB_ONLYBOTTOM)
if (lines[i].args[3] & TMFB_ONLYBOTTOM)
fflr->specialflags |= FS_ONLYBOTTOM;
if (lines[i].flags & ML_EFFECT4)
fflr->specialflags |= FS_PUSHABLES;