Store custom FOF flags directly in back toptexture field at map load instead of re-reading the sidedefs data later on

This commit is contained in:
MascaraSnake 2019-12-29 12:01:41 +01:00
parent b333770a3b
commit abdfe60aa7
2 changed files with 18 additions and 28 deletions

View file

@ -1179,6 +1179,20 @@ static void P_LoadSidedefs(UINT8 *data)
break; break;
} }
case 259: // Custom FOF
if (!isfrontside)
{
if ((msd->toptexture[0] >= '0' && msd->toptexture[0] <= '9')
|| (msd->toptexture[0] >= 'A' && msd->toptexture[0] <= 'F'))
sd->toptexture = axtoi(msd->toptexture);
else
I_Error("Custom FOF (tag %d) needs a value in the linedef's back side upper texture field.", sd->line->tag);
sd->midtexture = R_TextureNumForName(msd->midtexture);
sd->bottomtexture = R_TextureNumForName(msd->bottomtexture);
break;
}
// FALLTHRU
default: // normal cases default: // normal cases
if (msd->toptexture[0] == '#') if (msd->toptexture[0] == '#')
{ {

View file

@ -7179,38 +7179,14 @@ void P_SpawnSpecials(boolean fromnetsave)
EV_AddLaserThinker(&sectors[s], &sectors[sec], lines + i, secthinkers); EV_AddLaserThinker(&sectors[s], &sectors[sec], lines + i, secthinkers);
break; break;
case 259: // Make-Your-Own FOF! case 259: // Custom FOF
if (lines[i].sidenum[1] != 0xffff) if (lines[i].sidenum[1] != 0xffff)
{ {
UINT8 *data; ffloortype_e fofflags = sides[lines[i].sidenum[1]].toptexture;
UINT16 b; P_AddFakeFloorsByLine(i, fofflags, secthinkers);
if (!virt)
virt = vres_GetMap(lastloadedmaplumpnum);
data = (UINT8*) vres_Find(virt, "SIDEDEFS")->data;
for (b = 0; b < (INT16)numsides; b++)
{
register mapsidedef_t *msd = (mapsidedef_t *)data + b;
if (b == lines[i].sidenum[1])
{
if ((msd->toptexture[0] >= '0' && msd->toptexture[0] <= '9')
|| (msd->toptexture[0] >= 'A' && msd->toptexture[0] <= 'F'))
{
ffloortype_e FOF_Flags = axtoi(msd->toptexture);
P_AddFakeFloorsByLine(i, FOF_Flags, secthinkers);
break;
}
else
I_Error("Make-Your-Own-FOF (tag %d) needs a value in the linedef's second side upper texture field.", lines[i].tag);
}
}
} }
else else
I_Error("Make-Your-Own FOF (tag %d) found without a 2nd linedef side!", lines[i].tag); I_Error("Custom FOF (tag %d) found without a linedef back side!", lines[i].tag);
break; break;
case 300: // Linedef executor (combines with sector special 974/975) and commands case 300: // Linedef executor (combines with sector special 974/975) and commands