Merge branch 'sp-secfset-update-triggertag' into 'next'

Update triggertag on sector tag fset

Closes #865

See merge request STJr/SRB2!1789
This commit is contained in:
Eidolon 2022-05-31 21:15:56 +00:00
commit 6829e4ae62
4 changed files with 15 additions and 0 deletions

View file

@ -3677,6 +3677,7 @@ udmf
0 = "Add tag"; 0 = "Add tag";
1 = "Remove tag"; 1 = "Remove tag";
2 = "Replace first tag"; 2 = "Replace first tag";
3 = "Change trigger tag";
} }
} }
} }
@ -3699,6 +3700,7 @@ udmf
0 = "Add tag"; 0 = "Add tag";
1 = "Remove tag"; 1 = "Remove tag";
2 = "Replace first tag"; 2 = "Replace first tag";
3 = "Change trigger tag";
} }
} }
} }

View file

@ -2396,6 +2396,9 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
default: default:
Tag_SectorFSet(secnum, newtag); Tag_SectorFSet(secnum, newtag);
break; break;
case TMT_TRIGGERTAG:
sectors[secnum].triggertag = newtag;
break;
} }
} }
break; break;
@ -2418,6 +2421,9 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
default: default:
Tag_SectorFSet(secnum, newtag); Tag_SectorFSet(secnum, newtag);
break; break;
case TMT_TRIGGERTAG:
sectors[secnum].triggertag = newtag;
break;
} }
break; break;
} }

View file

@ -306,6 +306,7 @@ typedef enum
TMT_ADD = 0, TMT_ADD = 0,
TMT_REMOVE = 1, TMT_REMOVE = 1,
TMT_REPLACEFIRST = 2, TMT_REPLACEFIRST = 2,
TMT_TRIGGERTAG = 3,
} textmaptagoptions_t; } textmaptagoptions_t;
typedef enum typedef enum

View file

@ -14,6 +14,7 @@
#include "taglist.h" #include "taglist.h"
#include "z_zone.h" #include "z_zone.h"
#include "r_data.h" #include "r_data.h"
#include "p_spec.h"
// Bit array of whether a tag exists for sectors/lines/things. // Bit array of whether a tag exists for sectors/lines/things.
bitarray_t tags_available[BIT_ARRAY_SIZE (MAXTAGS)]; bitarray_t tags_available[BIT_ARRAY_SIZE (MAXTAGS)];
@ -454,6 +455,11 @@ void Tag_SectorFSet (const size_t id, const mtag_t tag)
Taggroup_Remove(tags_sectors, curtag, id); Taggroup_Remove(tags_sectors, curtag, id);
Taggroup_Add(tags_sectors, tag, id); Taggroup_Add(tags_sectors, tag, id);
Tag_FSet(&sec->tags, tag); Tag_FSet(&sec->tags, tag);
// Sectors with linedef trigger effects need to have their trigger tag updated too
// This is a bit of a hack...
if (!udmf && GETSECSPECIAL(sec->special, 2) >= 1 && GETSECSPECIAL(sec->special, 2) <= 7)
sec->triggertag = tag;
} }
mtag_t Tag_NextUnused(mtag_t start) mtag_t Tag_NextUnused(mtag_t start)