diff --git a/src/maploader/compatibility.cpp b/src/maploader/compatibility.cpp index 44dad087f..a3c979226 100644 --- a/src/maploader/compatibility.cpp +++ b/src/maploader/compatibility.cpp @@ -411,6 +411,27 @@ DEFINE_ACTION_FUNCTION(DLevelCompatibility, AddSectorTag) return 0; } +DEFINE_ACTION_FUNCTION(DLevelCompatibility, ClearLineIDs) +{ + PARAM_SELF_PROLOGUE(DLevelCompatibility); + PARAM_INT(line); + self->Level->tagManager.RemoveLineIDs(line); + return 0; +} + +DEFINE_ACTION_FUNCTION(DLevelCompatibility, AddLineID) +{ + PARAM_SELF_PROLOGUE(DLevelCompatibility); + PARAM_INT(line); + PARAM_INT(tag); + + if ((unsigned)line < self->Level->lines.Size()) + { + self->Level->tagManager.AddLineID(line, tag); + } + return 0; +} + DEFINE_ACTION_FUNCTION(DLevelCompatibility, SetThingSkills) { PARAM_SELF_PROLOGUE(DLevelCompatibility); diff --git a/src/p_tags.cpp b/src/p_tags.cpp index d6f509f84..654f0bb40 100644 --- a/src/p_tags.cpp +++ b/src/p_tags.cpp @@ -104,6 +104,28 @@ void FTagManager::RemoveSectorTags(int sect) // //----------------------------------------------------------------------------- +void FTagManager::RemoveLineIDs(int line) +{ + if (startForLine.Size() > (unsigned int)line) + { + int start = startForLine[line]; + if (start >= 0) + { + while (allIDs[start].target == line) + { + allTags[start].tag = allTags[start].target = -1; + start++; + } + } + } +} + +//----------------------------------------------------------------------------- +// +// +// +//----------------------------------------------------------------------------- + void FTagManager::AddLineID(int line, int tag) { if (tag == -1) return; // For line IDs -1 means 'not set', unlike sectors. diff --git a/src/p_tags.h b/src/p_tags.h index 23b77ee8d..8ce6b3568 100644 --- a/src/p_tags.h +++ b/src/p_tags.h @@ -66,6 +66,7 @@ public: void AddSectorTag(int sector, int tag); void AddLineID(int line, int tag); void RemoveSectorTags(int sect); + void RemoveLineIDs(int line); void DumpTags(); }; diff --git a/wadsrc/static/zscript/level_compatibility.txt b/wadsrc/static/zscript/level_compatibility.txt index fe9ecf0a9..29378b01e 100644 --- a/wadsrc/static/zscript/level_compatibility.txt +++ b/wadsrc/static/zscript/level_compatibility.txt @@ -1185,6 +1185,8 @@ class LevelCompatibility native play protected native void ClearSectorTags(int sector); protected native void AddSectorTag(int sector, int tag); + protected native void ClearLineIDs(int line); + protected native void AddLineID(int line, int tag); protected native void OffsetSectorPlane(int sector, int plane, double offset); protected native void SetThingSkills(int thing, int skills); protected native void SetThingXY(int thing, double x, double y);