Add linedef specials for multitagging in binary maps

This commit is contained in:
Vincent Robinson 2021-04-26 16:27:39 -07:00
parent 1355a82aa5
commit f437d6afec
3 changed files with 43 additions and 2 deletions

View file

@ -640,6 +640,24 @@ linedeftypes
prefix = "(63)";
}
97
{
title = "Apply Tag to Front Sector";
prefix = "(97)";
}
98
{
title = "Apply Tag to Back Sector";
prefix = "(98)";
}
99
{
title = "Apply Tag to Front and Back Sectors";
prefix = "(99)";
}
540
{
title = "Floor Friction";

View file

@ -2950,6 +2950,24 @@ 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_AddBinaryMapTags(void)
{
size_t i;
for (i = 0; i < numlines; i++)
{
// 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));
}
}
//For maps in binary format, converts setup of specials to UDMF format.
static void P_ConvertBinaryMap(void)
{
@ -3287,6 +3305,9 @@ static boolean P_LoadMapFromFile(void)
P_LinkMapData();
if (!udmf)
P_AddBinaryMapTags();
Taglist_InitGlobalTables();
if (!udmf)

View file

@ -27,11 +27,13 @@ taggroup_t* tags_sectors[MAXTAGS + 1];
taggroup_t* tags_lines[MAXTAGS + 1];
taggroup_t* tags_mapthings[MAXTAGS + 1];
/// Adds a tag to a given element's taglist.
/// Adds a tag to a given element's taglist. It will not add a duplicate.
/// \warning This does not rebuild the global taggroups, which are used for iteration.
void Tag_Add (taglist_t* list, const mtag_t tag)
{
list->tags = Z_Realloc(list->tags, (list->count + 1) * sizeof(list->tags), PU_LEVEL, NULL);
if (Tag_Find(list, tag))
return;
list->tags = Z_Realloc(list->tags, (list->count + 1) * sizeof(mtag_t), PU_LEVEL, NULL);
list->tags[list->count++] = tag;
}