- level post-processor can now add new things

This commit is contained in:
alexey.lysiuk 2019-10-27 16:29:00 +02:00
parent 1e29444152
commit c5237ce58f
2 changed files with 40 additions and 0 deletions

View file

@ -3381,6 +3381,42 @@ DEFINE_ACTION_FUNCTION(DLevelPostProcessor, GetThingCount)
ACTION_RETURN_INT(self->loader->MapThingsConverted.Size()); ACTION_RETURN_INT(self->loader->MapThingsConverted.Size());
} }
DEFINE_ACTION_FUNCTION(DLevelPostProcessor, AddThing)
{
PARAM_SELF_PROLOGUE(DLevelPostProcessor);
PARAM_UINT(ednum);
PARAM_FLOAT(x);
PARAM_FLOAT(y);
PARAM_FLOAT(z);
PARAM_INT(angle);
PARAM_UINT(skills);
PARAM_UINT(flags);
auto &things = self->loader->MapThingsConverted;
const unsigned newindex = things.Size();
things.Resize(newindex + 1);
auto &newthing = things.Last();
memset(&newthing, 0, sizeof newthing);
newthing.Gravity = 1;
newthing.SkillFilter = skills;
newthing.ClassFilter = 0xFFFF;
newthing.RenderStyle = STYLE_Count;
newthing.Alpha = -1;
newthing.Health = 1;
newthing.FloatbobPhase = -1;
newthing.pos.X = x;
newthing.pos.Y = y;
newthing.pos.Z = z;
newthing.angle = angle;
newthing.EdNum = ednum;
newthing.info = DoomEdMap.CheckKey(ednum);
newthing.flags = flags;
ACTION_RETURN_INT(newindex);
}
DEFINE_ACTION_FUNCTION(DLevelPostProcessor, GetThingEdNum) DEFINE_ACTION_FUNCTION(DLevelPostProcessor, GetThingEdNum)
{ {
PARAM_SELF_PROLOGUE(DLevelPostProcessor); PARAM_SELF_PROLOGUE(DLevelPostProcessor);

View file

@ -13,7 +13,11 @@ class LevelPostProcessor native play
protected native void AddLineID(int line, int tag); protected native void AddLineID(int line, int tag);
protected native void OffsetSectorPlane(int sector, int plane, double offset); protected native void OffsetSectorPlane(int sector, int plane, double offset);
const SKILLS_ALL = 31;
const MODES_ALL = MTF_SINGLE | MTF_COOPERATIVE | MTF_DEATHMATCH;
protected native uint GetThingCount(); protected native uint GetThingCount();
protected native uint AddThing(int ednum, Vector3 pos, int angle = 0, uint skills = SKILLS_ALL, uint flags = MODES_ALL);
protected native int GetThingEdNum(uint thing); protected native int GetThingEdNum(uint thing);
protected native void SetThingEdNum(uint thing, int ednum); protected native void SetThingEdNum(uint thing, int ednum);