fixed thing angles written in UDMF format

This commit is contained in:
codeimp 2009-01-07 20:22:12 +00:00
parent cdcaccf0eb
commit 74957e8dda
2 changed files with 8 additions and 2 deletions

View file

@ -177,10 +177,13 @@ namespace CodeImp.DoomBuilder.IO
foreach(string field in ft.Fields)
stringflags[field] = GetCollectionEntry<bool>(c, field, false, false);
}
// Translate angle
float angle = (float)(angledeg + 90) / Angle2D.PIDEG;
// Create new item
Thing t = map.CreateThing();
t.Update(type, x, y, height, Angle2D.DegToRad(angledeg), stringflags, tag, special, args);
t.Update(type, x, y, height, angle, stringflags, tag, special, args);
//t.DetermineSector();
t.UpdateConfiguration();

View file

@ -270,13 +270,16 @@ namespace CodeImp.DoomBuilder.IO
// Go for all things
foreach(Thing t in things)
{
// Calculate angle for UDMF
int angle = (int)(t.Angle * Angle2D.PIDEG) - 90;
// Make collection
UniversalCollection coll = new UniversalCollection();
if(t.Tag != 0) coll.Add("id", t.Tag);
coll.Add("x", t.Position.x);
coll.Add("y", t.Position.y);
if(t.Position.z != 0.0f) coll.Add("height", (float)t.Position.z);
coll.Add("angle", t.AngleDeg);
coll.Add("angle", angle);
coll.Add("type", t.Type);
if(t.Action != 0) coll.Add("special", t.Action);
if(t.Args[0] != 0) coll.Add("arg0", t.Args[0]);