Enhance the multitagging functionality added in previous commits.

* Flattened version of commits from SRB2 repository's flarn2006:multitagging_plus/merge request 1524.
* New linedef special 96: "Apply Tag to Tagged Sectors".
* New flags for linedef specials 97-99
This commit is contained in:
toaster 2022-03-18 17:06:22 +00:00
parent 2d50b76323
commit 1289e08887
2 changed files with 70 additions and 4 deletions

View file

@ -706,22 +706,37 @@ linedeftypes
prefix = "(80)";
}
96
{
title = "Apply Tag to Tagged Sectors";
prefix = "(96)";
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";
}
98
{
title = "Apply Tag to Back Sector";
prefix = "(98)";
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";
}
540

View file

@ -3042,19 +3042,70 @@ static void P_LinkMapData(void)
// For maps in binary format, add multi-tags from linedef specials. This must be done
// before any linedef specials have been processed.
static void P_AddBinaryMapTagsFromLine(sector_t *sector, line_t *line)
{
Tag_Add(&sector->tags, Tag_FGet(&line->tags));
if (line->flags & ML_EFFECT6) {
if (sides[line->sidenum[0]].textureoffset)
Tag_Add(&sector->tags, (INT32)sides[line->sidenum[0]].textureoffset / FRACUNIT);
if (sides[line->sidenum[0]].rowoffset)
Tag_Add(&sector->tags, (INT32)sides[line->sidenum[0]].rowoffset / FRACUNIT);
}
if (line->flags & ML_TFERLINE) {
if (sides[line->sidenum[1]].textureoffset)
Tag_Add(&sector->tags, (INT32)sides[line->sidenum[1]].textureoffset / FRACUNIT);
if (sides[line->sidenum[1]].rowoffset)
Tag_Add(&sector->tags, (INT32)sides[line->sidenum[1]].rowoffset / FRACUNIT);
}
}
static void P_AddBinaryMapTags(void)
{
size_t i;
for (i = 0; i < numlines; i++)
{
// 96: Apply Tag to Tagged Sectors
// 97: Apply Tag to Front Sector
// 98: Apply Tag to Back Sector
// 99: Apply Tag to Front and Back Sectors
if (lines[i].special == 97 || lines[i].special == 99)
Tag_Add(&lines[i].frontsector->tags, Tag_FGet(&lines[i].tags));
if (lines[i].special == 98 || lines[i].special == 99)
Tag_Add(&lines[i].backsector->tags, Tag_FGet(&lines[i].tags));
if (lines[i].special == 96) {
size_t j;
mtag_t tag = Tag_FGet(&lines[i].frontsector->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) {
offset_tags[0] = (INT32)sides[lines[i].sidenum[0]].textureoffset / FRACUNIT;
offset_tags[1] = (INT32)sides[lines[i].sidenum[0]].rowoffset / FRACUNIT;
}
if (lines[i].flags & ML_TFERLINE) {
offset_tags[2] = (INT32)sides[lines[i].sidenum[1]].textureoffset / FRACUNIT;
offset_tags[3] = (INT32)sides[lines[i].sidenum[1]].rowoffset / FRACUNIT;
}
for (j = 0; j < numsectors; j++) {
boolean matches_target_tag = Tag_Find(&sectors[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(&sectors[j].tags, offset_tags[k]))) {
Tag_Add(&sectors[j].tags, tag);
break;
}
} else if (matches_target_tag) {
if (k == 0)
Tag_Add(&sectors[j].tags, tag);
if (offset_tags[k])
Tag_Add(&sectors[j].tags, offset_tags[k]);
}
}
}
} else {
if (lines[i].special == 97 || lines[i].special == 99)
P_AddBinaryMapTagsFromLine(lines[i].frontsector, &lines[i]);
if (lines[i].special == 98 || lines[i].special == 99)
P_AddBinaryMapTagsFromLine(lines[i].backsector, &lines[i]);
}
}
}