Revamp alpha setup for bustable FOFs

This commit is contained in:
MascaraSnake 2020-06-12 10:31:26 +02:00
parent f4e28f5cc4
commit 3317827151
4 changed files with 30 additions and 27 deletions

View file

@ -2076,6 +2076,11 @@ udmf
type = 13;
}
arg1
{
title = "Alpha";
default = 255;
}
arg2
{
title = "Bustable type";
type = 11;
@ -2087,12 +2092,6 @@ udmf
3 = "Strong";
}
}
arg2
{
title = "Translucent?";
type = 11;
enum = "noyes";
}
arg3
{
title = "Flags";
@ -2102,6 +2101,7 @@ udmf
1 = "Bustable by pushables";
2 = "Trigger linedef executor";
4 = "Only bustable from below";
8 = "Cut cyan flat pixels";
}
}
arg4

View file

@ -3332,26 +3332,28 @@ static void P_ConvertBinaryMap(void)
case 256: //FOF: Spin-bustable block, translucent
lines[i].args[0] = lines[i].tag;
//Bustable type
if (lines[i].special <= 253)
lines[i].args[1] = TMFB_TOUCH;
else if (lines[i].special >= 255)
lines[i].args[1] = TMFB_SPIN;
else if (lines[i].flags & ML_NOCLIMB)
lines[i].args[1] = TMFB_STRONG;
else
lines[i].args[1] = TMFB_REGULAR;
//Translucency
//Alpha
if (lines[i].special == 253 || lines[i].special == 256)
{
lines[i].args[2] = 1;
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;
//Bustable type
if (lines[i].special <= 253)
lines[i].args[2] = TMFB_TOUCH;
else if (lines[i].special >= 255)
lines[i].args[2] = TMFB_SPIN;
else if (lines[i].flags & ML_NOCLIMB)
lines[i].args[2] = TMFB_STRONG;
else
lines[i].args[2] = TMFB_REGULAR;
//Flags
if (lines[i].flags & ML_EFFECT4)
lines[i].args[3] |= TMFB_PUSHABLES;
if (lines[i].flags & ML_EFFECT5)
@ -3360,7 +3362,9 @@ static void P_ConvertBinaryMap(void)
lines[i].args[4] = P_AproxDistance(lines[i].dx, lines[i].dy) >> FRACBITS;
}
if (lines[i].special == 252 && lines[i].flags & ML_NOCLIMB)
lines[i].args[4] |= TMFB_ONLYBOTTOM;
lines[i].args[3] |= TMFB_ONLYBOTTOM;
if (lines[i].flags & ML_EFFECT6)
lines[i].args[3] |= TMFB_SPLAT;
lines[i].special = 254;
break;

View file

@ -6873,7 +6873,7 @@ void P_SpawnSpecials(boolean fromnetsave)
ffloorflags = FF_EXISTS|FF_BLOCKOTHERS|FF_RENDERALL|FF_BUSTUP;
//Bustable type
switch (lines[i].args[1])
switch (lines[i].args[2])
{
case TMFB_TOUCH:
busttype = BT_TOUCH;
@ -6889,10 +6889,6 @@ void P_SpawnSpecials(boolean fromnetsave)
break;
}
//Translucent?
if (lines[i].args[2])
ffloorflags |= FF_TRANSLUCENT;
//Flags
if (lines[i].args[3] & TMFB_PUSHABLES)
bustflags |= FS_PUSHABLES;
@ -6900,13 +6896,15 @@ void P_SpawnSpecials(boolean fromnetsave)
bustflags |= FS_EXECUTOR;
if (lines[i].args[3] & TMFB_ONLYBOTTOM)
bustflags |= FS_ONLYBOTTOM;
if (lines[i].args[3] & TMFB_SPLAT)
ffloorflags |= FF_SPLAT;
if (busttype != BT_TOUCH || bustflags & FS_ONLYBOTTOM)
ffloorflags |= FF_BLOCKPLAYER;
for (s = -1; (s = P_FindSectorFromTag(lines[i].args[0], s)) >= 0 ;)
{
ffloor_t *fflr = P_AddFakeFloor(&sectors[s], lines[i].frontsector, lines + i, (ffloorflags & FF_TRANSLUCENT) ? (lines[i].alpha * 0xff) >> FRACBITS : 0xff, ffloorflags, secthinkers);
ffloor_t *fflr = P_AddFakeFloor(&sectors[s], lines[i].frontsector, lines + i, lines[i].args[1], ffloorflags, secthinkers);
fflr->busttype = busttype;
fflr->specialflags = bustflags;
fflr->busttag = lines[i].args[4];

View file

@ -95,6 +95,7 @@ typedef enum
TMFB_PUSHABLES = 1,
TMFB_EXECUTOR = 1<<1,
TMFB_ONLYBOTTOM = 1<<2,
TMFB_SPLAT = 1<<3,
} textmapfofbustflags_t;
typedef enum