- added things related getters to level post-processing

New functions cover existing interface only
Unsigned integers are now used instead signed for indices and bitfields
This commit is contained in:
alexey.lysiuk 2019-10-27 14:22:49 +02:00
parent 59bdebb20a
commit a2a50f34d5
2 changed files with 60 additions and 14 deletions

View file

@ -3375,27 +3375,54 @@ DEFINE_ACTION_FUNCTION(DLevelPostProcessor, AddLineID)
return 0;
}
DEFINE_ACTION_FUNCTION(DLevelPostProcessor, GetThingCount)
{
PARAM_SELF_PROLOGUE(DLevelPostProcessor);
ACTION_RETURN_INT(self->loader->MapThingsConverted.Size());
}
DEFINE_ACTION_FUNCTION(DLevelPostProcessor, GetThingSkills)
{
PARAM_SELF_PROLOGUE(DLevelPostProcessor);
PARAM_UINT(thing);
const int result = thing < self->loader->MapThingsConverted.Size()
? self->loader->MapThingsConverted[thing].SkillFilter : 0;
ACTION_RETURN_INT(result);
}
DEFINE_ACTION_FUNCTION(DLevelPostProcessor, SetThingSkills)
{
PARAM_SELF_PROLOGUE(DLevelPostProcessor);
PARAM_INT(thing);
PARAM_INT(skillmask);
PARAM_UINT(thing);
PARAM_UINT(skillmask);
if ((unsigned)thing < self->loader->MapThingsConverted.Size())
if (thing < self->loader->MapThingsConverted.Size())
{
self->loader->MapThingsConverted[thing].SkillFilter = skillmask;
}
return 0;
}
DEFINE_ACTION_FUNCTION(DLevelPostProcessor, GetThingPos)
{
PARAM_SELF_PROLOGUE(DLevelPostProcessor);
PARAM_UINT(thing);
const DVector3 result = thing < self->loader->MapThingsConverted.Size()
? self->loader->MapThingsConverted[thing].pos
: DVector3(0, 0, 0);
ACTION_RETURN_VEC3(result);
}
DEFINE_ACTION_FUNCTION(DLevelPostProcessor, SetThingXY)
{
PARAM_SELF_PROLOGUE(DLevelPostProcessor);
PARAM_INT(thing);
PARAM_UINT(thing);
PARAM_FLOAT(x);
PARAM_FLOAT(y);
if ((unsigned)thing < self->loader->MapThingsConverted.Size())
if (thing < self->loader->MapThingsConverted.Size())
{
auto& pos = self->loader->MapThingsConverted[thing].pos;
pos.X = x;
@ -3407,23 +3434,33 @@ DEFINE_ACTION_FUNCTION(DLevelPostProcessor, SetThingXY)
DEFINE_ACTION_FUNCTION(DLevelPostProcessor, SetThingZ)
{
PARAM_SELF_PROLOGUE(DLevelPostProcessor);
PARAM_INT(thing);
PARAM_UINT(thing);
PARAM_FLOAT(z);
if ((unsigned)thing < self->loader->MapThingsConverted.Size())
if (thing < self->loader->MapThingsConverted.Size())
{
self->loader->MapThingsConverted[thing].pos.Z = z;
}
return 0;
}
DEFINE_ACTION_FUNCTION(DLevelPostProcessor, GetThingFlags)
{
PARAM_SELF_PROLOGUE(DLevelPostProcessor);
PARAM_UINT(thing);
const unsigned result = thing < self->loader->MapThingsConverted.Size()
? self->loader->MapThingsConverted[thing].flags : 0;
ACTION_RETURN_INT(result);
}
DEFINE_ACTION_FUNCTION(DLevelPostProcessor, SetThingFlags)
{
PARAM_SELF_PROLOGUE(DLevelPostProcessor);
PARAM_INT(thing);
PARAM_INT(flags);
PARAM_UINT(thing);
PARAM_UINT(flags);
if ((unsigned)thing < self->loader->MapThingsConverted.Size())
if (thing < self->loader->MapThingsConverted.Size())
{
self->loader->MapThingsConverted[thing].flags = flags;
}

View file

@ -12,10 +12,19 @@ class LevelPostProcessor native play
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);
protected native void SetThingZ(int thing, double z);
protected native void SetThingFlags(int thing, int flags);
protected native uint GetThingCount();
protected native uint GetThingSkills(uint thing);
protected native void SetThingSkills(uint thing, uint skills);
protected native vector3 GetThingPos(uint thing);
protected native void SetThingXY(uint thing, double x, double y);
protected native void SetThingZ(uint thing, double z);
protected native uint GetThingFlags(uint thing);
protected native void SetThingFlags(uint thing, uint flags);
protected native void SetVertex(uint vertex, double x, double y);
protected native void SetLineSectorRef(uint line, uint side, uint sector);
protected native Actor GetDefaultActor(Name actorclass);