- allow assignment of line IDs through LevelCompatbility.

This commit is contained in:
Christoph Oelckers 2019-01-17 01:41:42 +01:00
parent dd2ea206f9
commit 5e4ef04a4d
4 changed files with 46 additions and 0 deletions

View File

@ -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);

View File

@ -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.

View File

@ -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();
};

View File

@ -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);