From 0b51b391f1a7e61f1e64992c92cd96e483b1ed08 Mon Sep 17 00:00:00 2001 From: flarn2006 Date: Sun, 30 May 2021 12:16:15 -0400 Subject: [PATCH] Make 96's flags consistent with 97-99 by default --- extras/conf/SRB2-22.cfg | 17 +++++++++-------- src/p_setup.c | 35 +++++++++++++++++++---------------- 2 files changed, 28 insertions(+), 24 deletions(-) diff --git a/extras/conf/SRB2-22.cfg b/extras/conf/SRB2-22.cfg index ad930a485..5a464eb5d 100644 --- a/extras/conf/SRB2-22.cfg +++ b/extras/conf/SRB2-22.cfg @@ -644,32 +644,33 @@ linedeftypes { title = "Apply Tag to Tagged Sectors"; prefix = "(96)"; - flags8192text = "[13] Use Front Side Offsets"; - flags32768text = "[15] Use Back Side Offsets"; + flags1024text = "[10] Offsets are target tags"; + flags8192text = "[13] Use front side offsets"; + flags32768text = "[15] Use back side offsets"; } 97 { title = "Apply Tag to Front Sector"; prefix = "(97)"; - flags8192text = "[13] Use Front Side Offsets"; - flags32768text = "[15] Use Back Side Offsets"; + flags8192text = "[13] Use front side offsets"; + flags32768text = "[15] Use back side offsets"; } 98 { title = "Apply Tag to Back Sector"; prefix = "(98)"; - flags8192text = "[13] Use Front Side Offsets"; - flags32768text = "[15] Use Back Side Offsets"; + flags8192text = "[13] Use front side offsets"; + flags32768text = "[15] Use back side offsets"; } 99 { title = "Apply Tag to Front and Back Sectors"; prefix = "(99)"; - flags8192text = "[13] Use Front Side Offsets"; - flags32768text = "[15] Use Back Side Offsets"; + flags8192text = "[13] Use front side offsets"; + flags32768text = "[15] Use back side offsets"; } 540 diff --git a/src/p_setup.c b/src/p_setup.c index f60af94ed..7ecaf2ff4 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2982,28 +2982,31 @@ static void P_AddBinaryMapTags(void) if (lines[i].special == 96) { size_t j; mtag_t tag = Tag_FGet(&lines[i].frontsector->tags); - mtag_t target_tags[5]; - target_tags[0] = Tag_FGet(&lines[i].tags); + mtag_t target_tag = Tag_FGet(&lines[i].tags); + mtag_t offset_tags[4]; + memset(offset_tags, 0, sizeof(mtag_t)*4); if (lines[i].flags & ML_EFFECT6) { - target_tags[1] = (INT32)sides[lines[i].sidenum[0]].textureoffset / FRACUNIT; - target_tags[2] = (INT32)sides[lines[i].sidenum[0]].rowoffset / FRACUNIT; - } else { - target_tags[1] = target_tags[2] = 0; + offset_tags[1] = (INT32)sides[lines[i].sidenum[0]].textureoffset / FRACUNIT; + offset_tags[2] = (INT32)sides[lines[i].sidenum[0]].rowoffset / FRACUNIT; } if (lines[i].flags & ML_TFERLINE) { - target_tags[3] = (INT32)sides[lines[i].sidenum[1]].textureoffset / FRACUNIT; - target_tags[4] = (INT32)sides[lines[i].sidenum[1]].rowoffset / FRACUNIT; - } else { - target_tags[3] = target_tags[4] = 0; + offset_tags[3] = (INT32)sides[lines[i].sidenum[1]].textureoffset / FRACUNIT; + offset_tags[4] = (INT32)sides[lines[i].sidenum[1]].rowoffset / FRACUNIT; } for (j = 0; j < numsectors; j++) { - size_t k; for (k = 0; k < 5; k++) { - if (k > 0 && !target_tags[k]) - continue; - if (Tag_Find(§ors[j].tags, target_tags[k])) { - Tag_Add(§ors[j].tags, tag); - break; + boolean matches_target_tag = Tag_Find(§ors[j].tags, target_tag); + size_t k; for (k = 0; k < 4; k++) { + if (lines[i].flags & ML_EFFECT5) { + if (matches_target_tag || offset_tags[k] && Tag_Find(§ors[j].tags, offset_tags[k])) { + Tag_Add(§ors[j].tags, tag); + break; + } + } else if (matches_target_tag) { + if (k == 0) + Tag_Add(§ors[j].tags, tag); + if (offset_tags[k]) + Tag_Add(§ors[j].tags, offset_tags[k]); } } }