mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-10 14:51:46 +00:00
- added SectorTagIterator and LineIDIterator script classes.
This commit is contained in:
parent
420f71fc4f
commit
20c56f6dda
4 changed files with 97 additions and 13 deletions
|
@ -1243,17 +1243,11 @@ void FMultiBlockThingsIterator::Reset()
|
||||||
|
|
||||||
class DBlockThingsIterator : public DObject, public FMultiBlockThingsIterator
|
class DBlockThingsIterator : public DObject, public FMultiBlockThingsIterator
|
||||||
{
|
{
|
||||||
DECLARE_CLASS(DBlockThingsIterator, DObject);
|
DECLARE_ABSTRACT_CLASS(DBlockThingsIterator, DObject);
|
||||||
FPortalGroupArray check;
|
FPortalGroupArray check;
|
||||||
protected:
|
|
||||||
DBlockThingsIterator()
|
|
||||||
:FMultiBlockThingsIterator(check)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
public:
|
public:
|
||||||
FMultiBlockThingsIterator::CheckResult cres;
|
FMultiBlockThingsIterator::CheckResult cres;
|
||||||
|
|
||||||
public:
|
|
||||||
bool Next()
|
bool Next()
|
||||||
{
|
{
|
||||||
return FMultiBlockThingsIterator::Next(&cres);
|
return FMultiBlockThingsIterator::Next(&cres);
|
||||||
|
@ -1276,7 +1270,7 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
IMPLEMENT_CLASS(DBlockThingsIterator, false, false);
|
IMPLEMENT_CLASS(DBlockThingsIterator, true, false);
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION(DBlockThingsIterator, Create)
|
DEFINE_ACTION_FUNCTION(DBlockThingsIterator, Create)
|
||||||
{
|
{
|
||||||
|
|
|
@ -362,3 +362,65 @@ int FLineIdIterator::Next()
|
||||||
start = tagManager.allIDs[start].nexttag;
|
start = tagManager.allIDs[start].nexttag;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class DSectorTagIterator : public DObject, public FSectorTagIterator
|
||||||
|
{
|
||||||
|
DECLARE_ABSTRACT_CLASS(DSectorTagIterator, DObject);
|
||||||
|
public:
|
||||||
|
DSectorTagIterator(int tag, line_t *line)
|
||||||
|
{
|
||||||
|
if (line == nullptr) Init(tag);
|
||||||
|
else Init(tag, line);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
IMPLEMENT_CLASS(DSectorTagIterator, true, false);
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION(DSectorTagIterator, Create)
|
||||||
|
{
|
||||||
|
PARAM_PROLOGUE;
|
||||||
|
PARAM_INT(tag);
|
||||||
|
PARAM_POINTER_DEF(line, line_t);
|
||||||
|
ACTION_RETURN_POINTER(new DSectorTagIterator(tag, line));
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION(DSectorTagIterator, Next)
|
||||||
|
{
|
||||||
|
PARAM_SELF_PROLOGUE(DSectorTagIterator);
|
||||||
|
ACTION_RETURN_INT(self->Next());
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION(DSectorTagIterator, NextCompat)
|
||||||
|
{
|
||||||
|
PARAM_SELF_PROLOGUE(DSectorTagIterator);
|
||||||
|
PARAM_BOOL(compat);
|
||||||
|
PARAM_INT(secnum);
|
||||||
|
ACTION_RETURN_INT(self->NextCompat(compat, secnum));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class DLineIdIterator : public DObject, public FLineIdIterator
|
||||||
|
{
|
||||||
|
DECLARE_ABSTRACT_CLASS(DLineIdIterator, DObject);
|
||||||
|
public:
|
||||||
|
DLineIdIterator(int tag)
|
||||||
|
: FLineIdIterator(tag)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
IMPLEMENT_CLASS(DLineIdIterator, true, false);
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION(DLineIdIterator, Create)
|
||||||
|
{
|
||||||
|
PARAM_PROLOGUE;
|
||||||
|
PARAM_INT(tag);
|
||||||
|
ACTION_RETURN_POINTER(new DLineIdIterator(tag));
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION(DLineIdIterator, Next)
|
||||||
|
{
|
||||||
|
PARAM_SELF_PROLOGUE(DLineIdIterator);
|
||||||
|
ACTION_RETURN_INT(self->Next());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
25
src/p_tags.h
25
src/p_tags.h
|
@ -77,20 +77,23 @@ protected:
|
||||||
int searchtag;
|
int searchtag;
|
||||||
int start;
|
int start;
|
||||||
|
|
||||||
public:
|
FSectorTagIterator()
|
||||||
FSectorTagIterator(int tag)
|
{
|
||||||
|
// For DSectorTagIterator
|
||||||
|
}
|
||||||
|
|
||||||
|
void Init(int tag)
|
||||||
{
|
{
|
||||||
searchtag = tag;
|
searchtag = tag;
|
||||||
start = tag == 0 ? 0 : tagManager.TagHashFirst[((unsigned int)tag) % FTagManager::TAG_HASH_SIZE];
|
start = tag == 0 ? 0 : tagManager.TagHashFirst[((unsigned int)tag) % FTagManager::TAG_HASH_SIZE];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Special constructor for actions that treat tag 0 as 'back of activation line'
|
void Init(int tag, line_t *line)
|
||||||
FSectorTagIterator(int tag, line_t *line)
|
|
||||||
{
|
{
|
||||||
if (tag == 0)
|
if (tag == 0)
|
||||||
{
|
{
|
||||||
searchtag = INT_MIN;
|
searchtag = INT_MIN;
|
||||||
start = (line == NULL || line->backsector == NULL)? -1 : line->backsector->Index();
|
start = (line == NULL || line->backsector == NULL) ? -1 : line->backsector->Index();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -99,6 +102,18 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
FSectorTagIterator(int tag)
|
||||||
|
{
|
||||||
|
Init(tag);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Special constructor for actions that treat tag 0 as 'back of activation line'
|
||||||
|
FSectorTagIterator(int tag, line_t *line)
|
||||||
|
{
|
||||||
|
Init(tag, line);
|
||||||
|
}
|
||||||
|
|
||||||
int Next();
|
int Next();
|
||||||
int NextCompat(bool compat, int secnum);
|
int NextCompat(bool compat, int secnum);
|
||||||
};
|
};
|
||||||
|
|
|
@ -440,3 +440,16 @@ struct Sector native play
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class SectorTagIterator : Object native
|
||||||
|
{
|
||||||
|
native static SectorTagIterator(int tag, line defline = null);
|
||||||
|
native int Next();
|
||||||
|
native int NextCompat(bool compat, int secnum);
|
||||||
|
}
|
||||||
|
|
||||||
|
class LineIdIterator : Object native
|
||||||
|
{
|
||||||
|
native static LineIdIterator(int tag);
|
||||||
|
native int Next();
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue