From 3a73c6167ccbbe1c9286c99043552253d91d936a Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Mon, 20 Sep 2021 14:42:21 +0200 Subject: [PATCH] Adapt linedef type 439 to UDMF --- extras/conf/udb/Includes/SRB222_linedefs.cfg | 23 ++++++++++++++++ src/p_setup.c | 5 ++++ src/p_spec.c | 29 +++++++++++--------- 3 files changed, 44 insertions(+), 13 deletions(-) diff --git a/extras/conf/udb/Includes/SRB222_linedefs.cfg b/extras/conf/udb/Includes/SRB222_linedefs.cfg index 9447a53ad..27d8454dd 100644 --- a/extras/conf/udb/Includes/SRB222_linedefs.cfg +++ b/extras/conf/udb/Includes/SRB222_linedefs.cfg @@ -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"; diff --git a/src/p_setup.c b/src/p_setup.c index 782253cbd..1476e1d43 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -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; diff --git a/src/p_spec.c b/src/p_spec.c index a4d358361..11a03056f 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2776,30 +2776,33 @@ 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 - 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. + 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; + } // Back side - 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; + 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;