In an Hexen mod I'm making, I've added 2 new classes which use Class4 and Class5 filters in map thing properties (UDMF format).
I'm trying to make the mod both able to be run with its own mapset and with vanilla or user-made maps.
The problem stands with vanilla maps: Things have not Class4 and Class5 properties defined and so the two new classes get empty levels with only geometry.
I have to specify that, due to the new classes' nature, I need class4 to spawn the same things as class1 (Fighter) and class5 to spawn class3's things (Mage).
I think I'm really close to a solution through the LevelPostProcessor class: by iterating through the entire map thing list it has to check whether the class1 spawner is active on the object and, if so, applies the class4 spawner as well (and same with class3 and class5).
However I'm not getting how I should write this kind of code: I'm not finding methods to modify UDMF map things and I've found no documentation that could help me.
Code: Select all
class HegemonyLevelPostProcessor : LevelPostProcessor
{
protected void Apply(Name checksum, String mapname)
{
name mapset = mapname.Left(6);
if(mapset != 'hegmap')
{
for (int i = 0; i < GetThingCount(); i++)
{
int flag = GetThingFlags(i);
Console.Printf(String.Format("%i",flag));
if(flag & 0x0020)//level.things[i].class1 == true)
{
AddThing(GetThingEdNum(i), GetThingPos(i), GetThingAngle(i), GetThingSkills(i), MODES_ALL);
SetThingFlags(i, 0x0020);
Console.Printf("Changed class");
//level.things[i].class1 = true;
//SetThingFlags(i, "class4");
}
if(flag & 0x0080)//level.things[i].class3 == true)
{
AddThing(GetThingEdNum(i), GetThingPos(i), GetThingAngle(i), GetThingSkills(i), MODES_ALL);
SetThingFlags(i, 0x0080);
Console.Printf("Changed class");
//level.things[i].class5 = true;
//SetThingFlags(i, "class5");
}
}
}
}
}