- level post-processor can now add new things

# Conflicts:
#	src/maploader/maploader.cpp
This commit is contained in:
alexey.lysiuk 2019-10-27 16:29:00 +02:00 committed by drfrag
parent 05f0b76f8e
commit 7f1166e833
2 changed files with 40 additions and 0 deletions

View file

@ -451,6 +451,42 @@ DEFINE_ACTION_FUNCTION(DLevelPostProcessor, GetThingCount)
ACTION_RETURN_INT(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 = 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)
{
PARAM_SELF_PROLOGUE(DLevelPostProcessor);

View file

@ -11,7 +11,11 @@ class LevelPostProcessor native play
protected native void AddLineID(int line, int tag);
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 AddThing(int ednum, Vector3 pos, int angle = 0, uint skills = SKILLS_ALL, uint flags = MODES_ALL);
protected native int GetThingEdNum(uint thing);
protected native void SetThingEdNum(uint thing, int ednum);