Fix custom FOF flag conversion in binary maps

This commit is contained in:
MascaraSnake 2022-06-04 10:59:42 +02:00
parent 44764cb1a4
commit fc4b79c0de
2 changed files with 120 additions and 2 deletions

View file

@ -3989,6 +3989,81 @@ static void P_SetBinaryFOFAlpha(line_t *line)
}
}
static INT32 P_GetFOFFlags(INT32 oldflags)
{
INT32 result = 0;
if (oldflags & FF_OLD_EXISTS)
result |= FF_EXISTS;
if (oldflags & FF_OLD_BLOCKPLAYER)
result |= FF_BLOCKPLAYER;
if (oldflags & FF_OLD_BLOCKOTHERS)
result |= FF_BLOCKOTHERS;
if (oldflags & FF_OLD_RENDERSIDES)
result |= FF_RENDERSIDES;
if (oldflags & FF_OLD_RENDERPLANES)
result |= FF_RENDERPLANES;
if (oldflags & FF_OLD_SWIMMABLE)
result |= FF_SWIMMABLE;
if (oldflags & FF_OLD_NOSHADE)
result |= FF_NOSHADE;
if (oldflags & FF_OLD_CUTSOLIDS)
result |= FF_CUTSOLIDS;
if (oldflags & FF_OLD_CUTEXTRA)
result |= FF_CUTEXTRA;
if (oldflags & FF_OLD_CUTSPRITES)
result |= FF_CUTSPRITES;
if (oldflags & FF_OLD_BOTHPLANES)
result |= FF_BOTHPLANES;
if (oldflags & FF_OLD_EXTRA)
result |= FF_EXTRA;
if (oldflags & FF_OLD_TRANSLUCENT)
result |= FF_TRANSLUCENT;
if (oldflags & FF_OLD_FOG)
result |= FF_FOG;
if (oldflags & FF_OLD_INVERTPLANES)
result |= FF_INVERTPLANES;
if (oldflags & FF_OLD_ALLSIDES)
result |= FF_ALLSIDES;
if (oldflags & FF_OLD_INVERTSIDES)
result |= FF_INVERTSIDES;
if (oldflags & FF_OLD_DOUBLESHADOW)
result |= FF_DOUBLESHADOW;
if (oldflags & FF_OLD_FLOATBOB)
result |= FF_FLOATBOB;
if (oldflags & FF_OLD_NORETURN)
result |= FF_NORETURN;
if (oldflags & FF_OLD_CRUMBLE)
result |= FF_CRUMBLE;
if (oldflags & FF_OLD_GOOWATER)
result |= FF_GOOWATER;
if (oldflags & FF_OLD_MARIO)
result |= FF_MARIO;
if (oldflags & FF_OLD_BUSTUP)
result |= FF_BUSTUP;
if (oldflags & FF_OLD_QUICKSAND)
result |= FF_QUICKSAND;
if (oldflags & FF_OLD_PLATFORM)
result |= FF_PLATFORM;
if (oldflags & FF_OLD_REVERSEPLATFORM)
result |= FF_REVERSEPLATFORM;
if (oldflags & FF_OLD_RIPPLE)
result |= FF_RIPPLE;
if (oldflags & FF_OLD_COLORMAPONLY)
result |= FF_COLORMAPONLY;
return result;
}
static INT32 P_GetFOFBustflags(INT32 oldflags)
{
if (oldflags & FF_OLD_SHATTER)
return TMFB_TOUCH;
if (oldflags & FF_OLD_SPINBUST)
return TMFB_SPIN;
if (oldflags & FF_OLD_STRONGBUST)
return TMFB_STRONG;
return TMFB_REGULAR;
}
static void P_ConvertBinaryLinedefTypes(void)
{
size_t i;
@ -4635,10 +4710,12 @@ static void P_ConvertBinaryLinedefTypes(void)
I_Error("Custom FOF (tag %d) found without a linedef back side!", tag);
lines[i].args[0] = tag;
lines[i].args[3] = sides[lines[i].sidenum[1]].toptexture;
lines[i].args[3] = P_GetFOFFlags(sides[lines[i].sidenum[1]].toptexture);
if (lines[i].flags & ML_EFFECT6)
lines[i].args[3] |= FF_SPLAT;
lines[i].args[4] = sides[lines[i].sidenum[1]].midtexture;
lines[i].args[4] = P_GetFOFBustflags(sides[lines[i].sidenum[1]].toptexture);
if (sides[lines[i].sidenum[1]].toptexture & FF_OLD_SHATTERBOTTOM)
lines[i].args[4] |= TMFB_ONLYBOTTOM;
if (lines[i].args[3] & FF_TRANSLUCENT)
{
P_SetBinaryFOFAlpha(&lines[i]);

View file

@ -152,6 +152,47 @@ typedef enum
FF_SPLAT = 0x40000000, ///< Use splat flat renderer (treat cyan pixels as invisible)
} ffloortype_e;
typedef enum
{
FF_OLD_EXISTS = 0x1,
FF_OLD_BLOCKPLAYER = 0x2,
FF_OLD_BLOCKOTHERS = 0x4,
FF_OLD_SOLID = 0x6,
FF_OLD_RENDERSIDES = 0x8,
FF_OLD_RENDERPLANES = 0x10,
FF_OLD_RENDERALL = 0x18,
FF_OLD_SWIMMABLE = 0x20,
FF_OLD_NOSHADE = 0x40,
FF_OLD_CUTSOLIDS = 0x80,
FF_OLD_CUTEXTRA = 0x100,
FF_OLD_CUTLEVEL = 0x180,
FF_OLD_CUTSPRITES = 0x200,
FF_OLD_BOTHPLANES = 0x400,
FF_OLD_EXTRA = 0x800,
FF_OLD_TRANSLUCENT = 0x1000,
FF_OLD_FOG = 0x2000,
FF_OLD_INVERTPLANES = 0x4000,
FF_OLD_ALLSIDES = 0x8000,
FF_OLD_INVERTSIDES = 0x10000,
FF_OLD_DOUBLESHADOW = 0x20000,
FF_OLD_FLOATBOB = 0x40000,
FF_OLD_NORETURN = 0x80000,
FF_OLD_CRUMBLE = 0x100000,
FF_OLD_SHATTERBOTTOM = 0x200000,
FF_OLD_GOOWATER = 0x200000,
FF_OLD_MARIO = 0x400000,
FF_OLD_BUSTUP = 0x800000,
FF_OLD_QUICKSAND = 0x1000000,
FF_OLD_PLATFORM = 0x2000000,
FF_OLD_REVERSEPLATFORM = 0x4000000,
FF_OLD_INTANGIBLEFLATS = 0x6000000,
FF_OLD_SHATTER = 0x8000000,
FF_OLD_SPINBUST = 0x10000000,
FF_OLD_STRONGBUST = 0x20000000,
FF_OLD_RIPPLE = 0x40000000,
FF_OLD_COLORMAPONLY = 0x80000000,
} oldffloortype_e;
typedef enum
{
FB_PUSHABLES = 0x1, // Bustable by pushables