Adapt linedef type 439 to UDMF

This commit is contained in:
MascaraSnake 2021-09-20 14:42:21 +02:00
parent 877ec96eec
commit 3a73c6167c
3 changed files with 44 additions and 13 deletions

View file

@ -3050,6 +3050,29 @@ udmf
}
}
439
{
title = "Change Tagged Linedef's Textures";
prefix = "(439)";
arg0
{
title = "Target linedef tag";
type = 15;
}
arg1
{
title = "Affected sides";
type = 11;
enum = "frontbackboth";
}
arg2
{
title = "Change unset textures?";
type = 11;
enum = "yesno";
}
}
440
{
title = "Start Metal Sonic Race";

View file

@ -3824,6 +3824,11 @@ static void P_ConvertBinaryMap(void)
lines[i].args[0] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS;
lines[i].args[1] = !!(lines[i].flags & ML_NOCLIMB);
break;
case 439: //Change tagged linedef's textures
lines[i].args[0] = tag;
lines[i].args[1] = TMSD_FRONTBACK;
lines[i].args[2] = !!(lines[i].flags & ML_NOCLIMB);
break;
case 441: //Condition set trigger
lines[i].args[0] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS;
break;

View file

@ -2776,32 +2776,35 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
{
size_t linenum;
side_t *set = &sides[line->sidenum[0]], *this;
boolean always = !(line->flags & ML_NOCLIMB); // If noclimb: Only change mid texture if mid texture already exists on tagged lines, etc.
boolean always = !(line->args[2]); // If args[2] is set: Only change mid texture if mid texture already exists on tagged lines, etc.
for (linenum = 0; linenum < numlines; linenum++)
{
if (lines[linenum].special == 439)
continue; // Don't override other set texture lines!
if (!Tag_Find(&lines[linenum].tags, tag))
if (!Tag_Find(&lines[linenum].tags, line->args[0]))
continue; // Find tagged lines
// Front side
if (line->args[1] != TMSD_BACK)
{
this = &sides[lines[linenum].sidenum[0]];
if (always || this->toptexture) this->toptexture = set->toptexture;
if (always || this->midtexture) this->midtexture = set->midtexture;
if (always || this->bottomtexture) this->bottomtexture = set->bottomtexture;
if (lines[linenum].sidenum[1] == 0xffff)
continue; // One-sided stops here.
}
// Back side
if (line->args[1] != TMSD_FRONT && lines[linenum].sidenum[1] != 0xffff)
{
this = &sides[lines[linenum].sidenum[1]];
if (always || this->toptexture) this->toptexture = set->toptexture;
if (always || this->midtexture) this->midtexture = set->midtexture;
if (always || this->bottomtexture) this->bottomtexture = set->bottomtexture;
}
}
}
break;
case 440: // Play race countdown and start Metal Sonic