Add linedef specials for multitagging in binary maps

# Conflicts:
#	extras/conf/SRB2Kart2.cfg
This commit is contained in:
toaster 2022-03-18 13:16:55 +00:00
parent 0b2783925f
commit 857330f74f
3 changed files with 43 additions and 2 deletions

View file

@ -706,6 +706,24 @@ linedeftypes
prefix = "(80)";
}
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

@ -3040,6 +3040,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)
{
@ -3406,6 +3424,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;
}