From 74957e8dda3ef84b3159045962326e735ca50e34 Mon Sep 17 00:00:00 2001 From: codeimp Date: Wed, 7 Jan 2009 20:22:12 +0000 Subject: [PATCH] fixed thing angles written in UDMF format --- Source/IO/UniversalStreamReader.cs | 5 ++++- Source/IO/UniversalStreamWriter.cs | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Source/IO/UniversalStreamReader.cs b/Source/IO/UniversalStreamReader.cs index 48efbe3d..3cf786e4 100644 --- a/Source/IO/UniversalStreamReader.cs +++ b/Source/IO/UniversalStreamReader.cs @@ -177,10 +177,13 @@ namespace CodeImp.DoomBuilder.IO foreach(string field in ft.Fields) stringflags[field] = GetCollectionEntry(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(); diff --git a/Source/IO/UniversalStreamWriter.cs b/Source/IO/UniversalStreamWriter.cs index 6d0029aa..4563f4cf 100644 --- a/Source/IO/UniversalStreamWriter.cs +++ b/Source/IO/UniversalStreamWriter.cs @@ -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]);