2017-01-08 22:04:55 +00:00
#region = = = = = = = = = = = = = = = = = = Namespaces
using System ;
2016-07-14 12:42:16 +00:00
using System.Collections.Generic ;
2015-08-08 21:56:43 +00:00
using CodeImp.DoomBuilder.Config ;
2012-09-26 00:04:17 +00:00
using CodeImp.DoomBuilder.Map ;
using CodeImp.DoomBuilder.Geometry ;
2016-07-14 12:42:16 +00:00
using CodeImp.DoomBuilder.Rendering ;
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
using CodeImp.DoomBuilder.VisualModes ;
2012-09-26 00:04:17 +00:00
2017-01-08 22:04:55 +00:00
#endregion
2014-12-03 23:15:26 +00:00
namespace CodeImp.DoomBuilder.GZBuilder.Data
{
2017-01-08 22:04:55 +00:00
public static class LinksCollector
2014-12-03 23:15:26 +00:00
{
2017-01-08 22:04:55 +00:00
#region = = = = = = = = = = = = = = = = = = SpecialThings
2015-08-08 21:56:43 +00:00
private class SpecialThings
2014-12-03 23:15:26 +00:00
{
2015-08-08 21:56:43 +00:00
public readonly Dictionary < int , List < Thing > > PatrolPoints ; // PatrolPoint tag, list of PatrolPoints
2017-02-14 17:33:50 +00:00
public readonly List < Thing > PatrolSpecials ;
2015-08-08 21:56:43 +00:00
public readonly Dictionary < int , List < PathNode > > InterpolationPoints ; // InterpolationPoint tag, list of InterpolationPoints
2017-02-14 17:33:50 +00:00
public readonly List < Thing > InterpolationSpecials ;
2015-08-08 21:56:43 +00:00
public readonly List < Thing > ThingsWithGoal ;
public readonly List < Thing > Cameras ;
public readonly Dictionary < int , List < Thing > > ActorMovers ; // ActorMover target tag, list of ActorMovers
public readonly List < Thing > PathFollowers ;
public readonly Dictionary < int , List < Thing > > PolyobjectAnchors ; //angle, list of PolyobjectAnchors
public readonly Dictionary < int , List < Thing > > PolyobjectStartSpots ; //angle, list of PolyobjectStartSpots
public SpecialThings ( )
{
PatrolPoints = new Dictionary < int , List < Thing > > ( ) ;
2017-02-14 17:33:50 +00:00
PatrolSpecials = new List < Thing > ( ) ;
2015-08-08 21:56:43 +00:00
InterpolationPoints = new Dictionary < int , List < PathNode > > ( ) ;
2017-02-14 17:33:50 +00:00
InterpolationSpecials = new List < Thing > ( ) ;
2015-08-08 21:56:43 +00:00
ThingsWithGoal = new List < Thing > ( ) ;
Cameras = new List < Thing > ( ) ;
ActorMovers = new Dictionary < int , List < Thing > > ( ) ;
PathFollowers = new List < Thing > ( ) ;
PolyobjectAnchors = new Dictionary < int , List < Thing > > ( ) ;
PolyobjectStartSpots = new Dictionary < int , List < Thing > > ( ) ;
}
}
2017-01-08 22:04:55 +00:00
#endregion
#region = = = = = = = = = = = = = = = = = = PathNode
2015-08-08 21:56:43 +00:00
private class PathNode
{
private readonly Thing thing ;
private readonly Vector3D position ;
private readonly Dictionary < int , PathNode > nextnodes ;
private readonly Dictionary < int , PathNode > prevnodes ;
public Thing Thing { get { return thing ; } }
public Dictionary < int , PathNode > NextNodes { get { return nextnodes ; } } // Thing index, PathNode
public Dictionary < int , PathNode > PreviousNodes { get { return prevnodes ; } } // Thing index, PathNode
public Vector3D Position { get { return position ; } }
public bool IsCurved ;
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
public PathNode ( Thing t , VisualBlockMap blockmap )
2015-08-08 21:56:43 +00:00
{
thing = t ;
2016-08-01 08:08:57 +00:00
position = t . Position ;
position . z + = GetCorrectHeight ( t , blockmap , true ) ;
2015-08-08 21:56:43 +00:00
nextnodes = new Dictionary < int , PathNode > ( ) ;
prevnodes = new Dictionary < int , PathNode > ( ) ;
}
2015-08-10 18:31:27 +00:00
internal void PropagateCurvedFlag ( )
{
if ( ! IsCurved ) return ;
foreach ( PathNode node in nextnodes . Values )
{
if ( node . IsCurved ) continue ;
node . IsCurved = true ;
node . PropagateCurvedFlag ( ) ;
}
foreach ( PathNode node in prevnodes . Values )
{
if ( node . IsCurved ) continue ;
node . IsCurved = true ;
node . PropagateCurvedFlag ( ) ;
}
}
2013-09-11 09:47:53 +00:00
}
2015-06-24 21:21:19 +00:00
2017-01-08 22:04:55 +00:00
#endregion
#region = = = = = = = = = = = = = = = = = = Constants
private const int CIRCLE_SIDES = 24 ;
#endregion
#region = = = = = = = = = = = = = = = = = = Shape creation methods
private static IEnumerable < Line3D > MakeCircleLines ( Vector3D pos , PixelColor color , float radius , int numsides )
2016-07-14 12:42:16 +00:00
{
List < Line3D > result = new List < Line3D > ( numsides ) ;
2016-08-01 08:08:57 +00:00
Vector3D start = new Vector3D ( pos . x , pos . y + radius , pos . z ) ;
2016-07-14 12:42:16 +00:00
float anglestep = Angle2D . PI2 / numsides ;
for ( int i = 1 ; i < numsides + 1 ; i + + )
{
2016-08-01 08:08:57 +00:00
Vector3D end = pos + new Vector3D ( ( float ) Math . Sin ( anglestep * i ) * radius , ( float ) Math . Cos ( anglestep * i ) * radius , 0f ) ;
2016-07-14 12:42:16 +00:00
result . Add ( new Line3D ( start , end , color , false ) ) ;
start = end ;
}
return result ;
}
2017-01-08 22:04:55 +00:00
private static IEnumerable < Line3D > MakeRectangleLines ( Vector3D pos , PixelColor color , float size )
2016-07-14 12:42:16 +00:00
{
float halfsize = size / 2 ;
2016-08-01 08:08:57 +00:00
Vector3D tl = new Vector3D ( pos . x - halfsize , pos . y - halfsize , pos . z ) ;
Vector3D tr = new Vector3D ( pos . x + halfsize , pos . y - halfsize , pos . z ) ;
Vector3D bl = new Vector3D ( pos . x - halfsize , pos . y + halfsize , pos . z ) ;
Vector3D br = new Vector3D ( pos . x + halfsize , pos . y + halfsize , pos . z ) ;
2016-07-14 12:42:16 +00:00
return new List < Line3D >
{
new Line3D ( tl , tr , color , false ) ,
new Line3D ( tr , br , color , false ) ,
new Line3D ( bl , br , color , false ) ,
new Line3D ( bl , tl , color , false ) ,
} ;
2017-01-08 22:04:55 +00:00
}
#endregion
2016-07-14 12:42:16 +00:00
2017-01-08 22:04:55 +00:00
#region = = = = = = = = = = = = = = = = = = GetHelperShapes
public static List < Line3D > GetHelperShapes ( ICollection < Thing > things ) { return GetHelperShapes ( things , null ) ; }
public static List < Line3D > GetHelperShapes ( ICollection < Thing > things , VisualBlockMap blockmap )
2014-12-03 23:15:26 +00:00
{
2017-01-08 22:04:55 +00:00
var lines = GetHelperShapes ( GetSpecialThings ( things , blockmap ) , blockmap ) ;
lines . AddRange ( GetThingArgumentShapes ( things , blockmap , CIRCLE_SIDES ) ) ;
return lines ;
2013-09-11 09:47:53 +00:00
}
2017-01-08 22:04:55 +00:00
private static SpecialThings GetSpecialThings ( ICollection < Thing > things , VisualBlockMap blockmap )
2014-12-03 23:15:26 +00:00
{
2015-08-08 21:56:43 +00:00
SpecialThings result = new SpecialThings ( ) ;
2012-09-26 00:04:17 +00:00
2015-08-08 21:56:43 +00:00
// Process oh so special things
2015-09-16 12:10:43 +00:00
foreach ( Thing t in things )
2014-12-03 23:15:26 +00:00
{
2015-09-16 12:10:43 +00:00
ThingTypeInfo info = General . Map . Data . GetThingInfoEx ( t . Type ) ;
if ( info = = null ) continue ;
2015-12-28 15:01:53 +00:00
switch ( info . ClassName . ToLowerInvariant ( ) )
2014-12-03 23:15:26 +00:00
{
2015-08-08 21:56:43 +00:00
case "patrolpoint" :
2015-09-16 12:10:43 +00:00
if ( t . Tag ! = 0 | | t . Args [ 0 ] ! = 0 )
2015-08-08 21:56:43 +00:00
{
if ( ! result . PatrolPoints . ContainsKey ( t . Tag ) ) result . PatrolPoints . Add ( t . Tag , new List < Thing > ( ) ) ;
result . PatrolPoints [ t . Tag ] . Add ( t ) ;
}
break ;
2017-02-14 17:33:50 +00:00
case "patrolspecial" :
result . PatrolSpecials . Add ( t ) ;
break ;
2015-08-08 21:56:43 +00:00
case "$polyanchor" :
if ( ! result . PolyobjectAnchors . ContainsKey ( t . AngleDoom ) ) result . PolyobjectAnchors [ t . AngleDoom ] = new List < Thing > ( ) ;
result . PolyobjectAnchors [ t . AngleDoom ] . Add ( t ) ;
break ;
case "$polyspawn" :
case "$polyspawncrush" :
case "$polyspawnhurt" :
if ( ! result . PolyobjectStartSpots . ContainsKey ( t . AngleDoom ) ) result . PolyobjectStartSpots [ t . AngleDoom ] = new List < Thing > ( ) ;
result . PolyobjectStartSpots [ t . AngleDoom ] . Add ( t ) ;
break ;
2013-09-11 09:47:53 +00:00
}
2015-03-06 19:12:12 +00:00
2015-08-08 21:56:43 +00:00
// Process Thing_SetGoal action
if ( t . Action ! = 0
& & General . Map . Config . LinedefActions . ContainsKey ( t . Action )
& & General . Map . Config . LinedefActions [ t . Action ] . Id . ToLowerInvariant ( ) = = "thing_setgoal"
& & ( t . Args [ 0 ] = = 0 | | t . Args [ 0 ] = = t . Tag )
& & t . Args [ 1 ] ! = 0 )
2014-12-03 23:15:26 +00:00
{
2015-08-08 21:56:43 +00:00
result . ThingsWithGoal . Add ( t ) ;
2013-09-11 09:47:53 +00:00
}
2015-08-08 21:56:43 +00:00
}
2015-03-06 19:12:12 +00:00
2015-08-16 23:42:57 +00:00
// We may need all of these actors...
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
foreach ( Thing t in General . Map . ThingsFilter . VisibleThings )
2015-08-08 21:56:43 +00:00
{
2015-09-16 12:10:43 +00:00
ThingTypeInfo info = General . Map . Data . GetThingInfoEx ( t . Type ) ;
if ( info = = null ) continue ;
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
switch ( info . ClassName . ToLowerInvariant ( ) )
2015-03-06 19:12:12 +00:00
{
2015-08-08 21:56:43 +00:00
case "interpolationpoint" :
if ( ! result . InterpolationPoints . ContainsKey ( t . Tag ) ) result . InterpolationPoints . Add ( t . Tag , new List < PathNode > ( ) ) ;
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
result . InterpolationPoints [ t . Tag ] . Add ( new PathNode ( t , blockmap ) ) ;
2015-08-08 21:56:43 +00:00
break ;
2015-08-16 23:42:57 +00:00
2017-02-14 17:33:50 +00:00
case "interpolationspecial" :
result . InterpolationSpecials . Add ( t ) ;
break ;
2015-08-16 23:42:57 +00:00
case "movingcamera" :
if ( t . Args [ 0 ] ! = 0 | | t . Args [ 1 ] ! = 0 ) result . Cameras . Add ( t ) ;
break ;
case "pathfollower" :
if ( t . Args [ 0 ] ! = 0 | | t . Args [ 1 ] ! = 0 ) result . PathFollowers . Add ( t ) ;
break ;
case "actormover" :
if ( ( t . Args [ 0 ] ! = 0 | | t . Args [ 1 ] ! = 0 ) & & t . Args [ 3 ] ! = 0 )
{
if ( ! result . ActorMovers . ContainsKey ( t . Args [ 3 ] ) ) result . ActorMovers . Add ( t . Args [ 3 ] , new List < Thing > ( ) ) ;
result . ActorMovers [ t . Args [ 3 ] ] . Add ( t ) ;
}
break ;
2015-03-06 19:12:12 +00:00
}
2013-09-11 09:47:53 +00:00
}
2012-09-26 00:04:17 +00:00
2015-08-08 21:56:43 +00:00
return result ;
}
2017-01-08 22:04:55 +00:00
private static List < Line3D > GetHelperShapes ( SpecialThings result , VisualBlockMap blockmap )
2015-08-08 21:56:43 +00:00
{
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
var lines = new List < Line3D > ( ) ;
var actormovertargets = new Dictionary < int , List < Thing > > ( ) ;
2015-08-08 21:56:43 +00:00
// Get ActorMover targets
if ( result . ActorMovers . Count > 0 )
2014-12-03 23:15:26 +00:00
{
foreach ( Thing t in General . Map . Map . Things )
{
2015-08-08 21:56:43 +00:00
if ( t . Tag = = 0 | | ! result . ActorMovers . ContainsKey ( t . Tag ) ) continue ;
if ( ! actormovertargets . ContainsKey ( t . Tag ) ) actormovertargets [ t . Tag ] = new List < Thing > ( ) ;
actormovertargets [ t . Tag ] . Add ( t ) ;
2012-09-26 00:04:17 +00:00
}
}
2014-02-21 14:42:12 +00:00
Vector3D start , end ;
2012-09-26 00:04:17 +00:00
2015-08-08 21:56:43 +00:00
// Process patrol points
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
foreach ( KeyValuePair < int , List < Thing > > group in result . PatrolPoints )
2014-12-03 23:15:26 +00:00
{
2015-08-08 21:56:43 +00:00
foreach ( Thing t in group . Value )
2014-12-03 23:15:26 +00:00
{
2015-08-08 21:56:43 +00:00
if ( ! result . PatrolPoints . ContainsKey ( t . Args [ 0 ] ) ) continue ;
start = t . Position ;
2016-08-01 08:08:57 +00:00
start . z + = GetCorrectHeight ( t , blockmap , true ) ;
2015-08-08 21:56:43 +00:00
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
foreach ( Thing tt in result . PatrolPoints [ t . Args [ 0 ] ] )
2014-12-03 23:15:26 +00:00
{
2015-08-08 21:56:43 +00:00
end = tt . Position ;
2016-08-01 08:08:57 +00:00
end . z + = GetCorrectHeight ( tt , blockmap , true ) ;
2015-08-08 21:56:43 +00:00
lines . Add ( new Line3D ( start , end ) ) ;
2012-09-26 00:04:17 +00:00
}
2013-09-11 09:47:53 +00:00
}
}
2012-09-26 00:04:17 +00:00
2015-08-08 21:56:43 +00:00
// Process things with Thing_SetGoal
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
foreach ( Thing t in result . ThingsWithGoal )
2014-12-03 23:15:26 +00:00
{
2015-08-08 21:56:43 +00:00
if ( ! result . PatrolPoints . ContainsKey ( t . Args [ 1 ] ) ) continue ;
start = t . Position ;
2016-08-01 08:08:57 +00:00
start . z + = GetCorrectHeight ( t , blockmap , true ) ;
2015-08-08 21:56:43 +00:00
foreach ( Thing tt in result . PatrolPoints [ t . Args [ 1 ] ] )
2014-12-03 23:15:26 +00:00
{
2015-08-08 21:56:43 +00:00
end = tt . Position ;
2016-08-01 08:08:57 +00:00
end . z + = GetCorrectHeight ( tt , blockmap , true ) ;
2015-08-08 21:56:43 +00:00
lines . Add ( new Line3D ( start , end , General . Colors . Selection ) ) ;
}
}
2017-02-14 17:33:50 +00:00
// Process patrol specials
foreach ( Thing t in result . PatrolSpecials )
{
if ( ! result . PatrolPoints . ContainsKey ( t . Tag ) ) continue ;
start = t . Position ;
start . z + = GetCorrectHeight ( t , blockmap , true ) ;
foreach ( Thing tt in result . PatrolPoints [ t . Tag ] )
{
end = tt . Position ;
end . z + = GetCorrectHeight ( tt , blockmap , true ) ;
lines . Add ( new Line3D ( start , end , General . Colors . Selection ) ) ;
}
}
2015-08-08 21:56:43 +00:00
// Process cameras [CAN USE INTERPOLATION]
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
foreach ( Thing t in result . Cameras )
2015-08-08 21:56:43 +00:00
{
int targettag = t . Args [ 0 ] + ( t . Args [ 1 ] < < 8 ) ;
2016-08-01 08:08:57 +00:00
if ( targettag = = 0 | | ! result . InterpolationPoints . ContainsKey ( targettag ) ) continue ; //no target / target doesn't exist
2015-08-08 21:56:43 +00:00
bool interpolatepath = ( ( t . Args [ 2 ] & 1 ) ! = 1 ) ;
2012-09-26 00:04:17 +00:00
2015-08-08 21:56:43 +00:00
start = t . Position ;
2016-08-01 08:08:57 +00:00
start . z + = GetCorrectHeight ( t , blockmap , true ) ;
2012-09-26 00:04:17 +00:00
2015-08-08 21:56:43 +00:00
foreach ( PathNode node in result . InterpolationPoints [ targettag ] )
{
node . IsCurved = interpolatepath ;
lines . Add ( new Line3D ( start , node . Position , General . Colors . Selection ) ) ;
2013-09-11 09:47:53 +00:00
}
}
2015-08-08 21:56:43 +00:00
//process actor movers [CAN USE INTERPOLATION]
foreach ( List < Thing > things in result . ActorMovers . Values )
2014-12-03 23:15:26 +00:00
{
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
foreach ( Thing t in things )
2014-12-03 23:15:26 +00:00
{
2015-08-08 21:56:43 +00:00
int targettag = t . Args [ 0 ] + ( t . Args [ 1 ] < < 8 ) ;
// Add interpolation point targets
if ( targettag ! = 0 & & result . InterpolationPoints . ContainsKey ( targettag ) )
2014-12-03 23:15:26 +00:00
{
2015-08-08 21:56:43 +00:00
bool interpolatepath = ( ( t . Args [ 2 ] & 1 ) ! = 1 ) ;
start = t . Position ;
2016-08-01 08:08:57 +00:00
start . z + = GetCorrectHeight ( t , blockmap , true ) ;
2012-09-26 00:04:17 +00:00
2015-08-08 21:56:43 +00:00
foreach ( PathNode node in result . InterpolationPoints [ targettag ] )
2014-12-03 23:15:26 +00:00
{
2015-08-08 21:56:43 +00:00
node . IsCurved = interpolatepath ;
lines . Add ( new Line3D ( start , node . Position , General . Colors . Selection ) ) ;
2012-09-26 00:04:17 +00:00
}
}
2015-08-08 21:56:43 +00:00
// Add thing-to-move targets
if ( actormovertargets . ContainsKey ( t . Args [ 3 ] ) )
2014-12-03 23:15:26 +00:00
{
2012-09-26 00:04:17 +00:00
start = t . Position ;
2016-08-01 08:08:57 +00:00
start . z + = GetCorrectHeight ( t , blockmap , true ) ;
2012-09-26 00:04:17 +00:00
2015-08-08 21:56:43 +00:00
foreach ( Thing tt in actormovertargets [ t . Args [ 3 ] ] )
2014-12-03 23:15:26 +00:00
{
2012-09-26 00:04:17 +00:00
end = tt . Position ;
2016-08-01 08:08:57 +00:00
end . z + = GetCorrectHeight ( tt , blockmap , true ) ;
2015-08-08 21:56:43 +00:00
lines . Add ( new Line3D ( start , end , General . Colors . Selection ) ) ;
2012-09-26 00:04:17 +00:00
}
}
2013-09-11 09:47:53 +00:00
}
}
2012-09-26 00:04:17 +00:00
2015-08-08 21:56:43 +00:00
// Process path followers [CAN USE INTERPOLATION]
foreach ( Thing t in result . PathFollowers )
2014-12-03 23:15:26 +00:00
{
2015-08-08 21:56:43 +00:00
int targettag = t . Args [ 0 ] + ( t . Args [ 1 ] < < 8 ) ;
2016-08-01 08:08:57 +00:00
if ( targettag = = 0 | | ! result . InterpolationPoints . ContainsKey ( targettag ) ) continue ; //no target / target doesn't exist
2015-08-08 21:56:43 +00:00
bool interpolatepath = ( t . Args [ 2 ] & 1 ) ! = 1 ;
start = t . Position ;
2016-08-01 08:08:57 +00:00
start . z + = GetCorrectHeight ( t , blockmap , true ) ;
2015-08-08 21:56:43 +00:00
foreach ( PathNode node in result . InterpolationPoints [ targettag ] )
2014-12-03 23:15:26 +00:00
{
2015-08-08 21:56:43 +00:00
node . IsCurved = interpolatepath ;
lines . Add ( new Line3D ( start , node . Position , General . Colors . Selection ) ) ;
}
}
2012-09-26 00:04:17 +00:00
2015-08-08 21:56:43 +00:00
// Process polyobjects
foreach ( KeyValuePair < int , List < Thing > > group in result . PolyobjectAnchors )
{
if ( ! result . PolyobjectStartSpots . ContainsKey ( group . Key ) ) continue ;
foreach ( Thing anchor in group . Value )
{
start = anchor . Position ;
2016-08-01 08:08:57 +00:00
start . z + = GetCorrectHeight ( anchor , blockmap , true ) ;
2012-09-26 00:04:17 +00:00
2015-08-08 21:56:43 +00:00
foreach ( Thing startspot in result . PolyobjectStartSpots [ group . Key ] )
{
end = startspot . Position ;
2016-08-01 08:08:57 +00:00
end . z + = GetCorrectHeight ( startspot , blockmap , true ) ;
2015-08-08 21:56:43 +00:00
lines . Add ( new Line3D ( start , end , General . Colors . Selection ) ) ;
2012-09-26 00:04:17 +00:00
}
2015-08-08 21:56:43 +00:00
}
}
2012-09-26 00:04:17 +00:00
2015-08-08 21:56:43 +00:00
// Process interpolation points [CAN BE INTERPOLATED]
// 1. Connect PathNodes
foreach ( KeyValuePair < int , List < PathNode > > group in result . InterpolationPoints )
{
foreach ( PathNode node in group . Value )
{
int targettag = node . Thing . Args [ 3 ] + ( node . Thing . Args [ 4 ] < < 8 ) ;
if ( targettag = = 0 | | ! result . InterpolationPoints . ContainsKey ( targettag ) ) continue ;
2012-09-26 00:04:17 +00:00
2015-08-08 21:56:43 +00:00
foreach ( PathNode targetnode in result . InterpolationPoints [ targettag ] )
{
// Connect both ways
2015-08-10 18:31:27 +00:00
if ( ! node . NextNodes . ContainsKey ( targetnode . Thing . Index ) ) node . NextNodes . Add ( targetnode . Thing . Index , targetnode ) ;
if ( ! targetnode . PreviousNodes . ContainsKey ( node . Thing . Index ) ) targetnode . PreviousNodes . Add ( node . Thing . Index , node ) ;
2012-09-26 00:04:17 +00:00
}
}
}
2015-08-10 18:31:27 +00:00
// 2. Propagate IsCurved flag
foreach ( KeyValuePair < int , List < PathNode > > group in result . InterpolationPoints )
{
foreach ( PathNode node in group . Value ) node . PropagateCurvedFlag ( ) ;
}
2017-02-14 17:33:50 +00:00
// Process interpolation specials
foreach ( Thing t in result . InterpolationSpecials )
{
int targettag = t . Tag ;
if ( targettag = = 0 | | ! result . InterpolationPoints . ContainsKey ( targettag ) ) continue ; //no target / target doesn't exist
start = t . Position ;
start . z + = GetCorrectHeight ( t , blockmap , true ) ;
foreach ( PathNode node in result . InterpolationPoints [ targettag ] )
{
//Do not connect specials to the first or last node of a curved path, since those are used as spline control points only
if ( node . IsCurved & & ( node . PreviousNodes . Count = = 0 | | node . NextNodes . Count = = 0 ) )
continue ;
lines . Add ( new Line3D ( start , node . Position , General . Colors . Selection ) ) ;
}
}
2015-08-10 18:31:27 +00:00
// 3. Make lines
2015-08-08 21:56:43 +00:00
HashSet < int > processedindices = new HashSet < int > ( ) ;
foreach ( KeyValuePair < int , List < PathNode > > group in result . InterpolationPoints )
2015-03-06 19:12:12 +00:00
{
2015-08-08 21:56:43 +00:00
foreach ( PathNode node in group . Value )
2015-03-06 19:12:12 +00:00
{
2015-08-08 21:56:43 +00:00
// Draw as a curve?
if ( node . IsCurved & & ! processedindices . Contains ( node . Thing . Index ) & & node . NextNodes . Count > 0 & & node . PreviousNodes . Count > 0 )
2015-03-06 19:12:12 +00:00
{
2015-08-08 21:56:43 +00:00
PathNode prev = General . GetByIndex ( node . PreviousNodes , 0 ) . Value ;
PathNode next = General . GetByIndex ( node . NextNodes , 0 ) . Value ;
if ( next . NextNodes . Count > 0 )
2015-03-06 19:12:12 +00:00
{
2015-08-08 21:56:43 +00:00
PathNode nextnext = General . GetByIndex ( next . NextNodes , 0 ) . Value ;
// Generate curve points
List < Vector3D > points = new List < Vector3D > ( 11 ) ;
for ( int i = 0 ; i < 11 ; i + + )
{
float u = i * 0.1f ;
points . Add ( new Vector3D (
SplineLerp ( u , prev . Position . x , node . Position . x , next . Position . x , nextnext . Position . x ) ,
SplineLerp ( u , prev . Position . y , node . Position . y , next . Position . y , nextnext . Position . y ) ,
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
( blockmap = = null ? 0 : SplineLerp ( u , prev . Position . z , node . Position . z , next . Position . z , nextnext . Position . z ) )
2015-08-08 21:56:43 +00:00
) ) ;
}
// Add line segments
for ( int i = 1 ; i < 11 ; i + + )
{
lines . Add ( new Line3D ( points [ i - 1 ] , points [ i ] , i = = 10 ) ) ;
}
continue ;
2015-03-06 19:12:12 +00:00
}
}
2015-08-08 21:56:43 +00:00
// Draw regular lines
bool startnode = ( node . IsCurved & & node . PreviousNodes . Count = = 0 ) ; // When using curves, this node won't be used by camera (the last node won't be used as well), so draw them using different color
foreach ( PathNode targetnode in node . NextNodes . Values )
{
bool isskipped = ( startnode | | ( targetnode . IsCurved & & targetnode . NextNodes . Count = = 0 ) ) ;
lines . Add ( new Line3D ( node . Position , targetnode . Position , ( isskipped ? General . Colors . Highlight : General . Colors . InfoLine ) , ! isskipped ) ) ;
}
2015-03-06 19:12:12 +00:00
}
}
2017-01-08 22:04:55 +00:00
return lines ;
}
#endregion
#region = = = = = = = = = = = = = = = = = = GetThingArgumentShapes
// Create argument value/min/max shapes
private static List < Line3D > GetThingArgumentShapes ( ICollection < Thing > things , VisualBlockMap blockmap , int numsides )
{
var lines = new List < Line3D > ( ) ;
foreach ( Thing t in things )
2016-07-14 12:42:16 +00:00
{
if ( t . Action ! = 0 ) continue ;
ThingTypeInfo tti = General . Map . Data . GetThingInfoEx ( t . Type ) ;
if ( tti = = null ) continue ;
2016-08-01 08:08:57 +00:00
Vector3D pos = t . Position ;
pos . z + = GetCorrectHeight ( t , blockmap , false ) ;
2016-07-14 12:42:16 +00:00
for ( int i = 0 ; i < t . Args . Length ; i + + )
{
2017-01-08 22:04:55 +00:00
if ( t . Args [ i ] = = 0 ) continue ; // Avoid visual noise
var a = tti . Args [ i ] ; //TODO: can this be null?
switch ( a . RenderStyle )
2016-07-14 12:42:16 +00:00
{
2017-01-08 22:04:55 +00:00
case ArgumentInfo . ArgumentRenderStyle . CIRCLE :
lines . AddRange ( MakeCircleLines ( pos , a . RenderColor , t . Args [ i ] , numsides ) ) ;
if ( a . MinRange > 0 ) lines . AddRange ( MakeCircleLines ( pos , a . MinRangeColor , a . MinRange , numsides ) ) ;
if ( a . MaxRange > 0 ) lines . AddRange ( MakeCircleLines ( pos , a . MaxRangeColor , a . MaxRange , numsides ) ) ;
break ;
case ArgumentInfo . ArgumentRenderStyle . RECTANGLE :
lines . AddRange ( MakeRectangleLines ( pos , a . RenderColor , t . Args [ i ] ) ) ;
if ( a . MinRange > 0 ) lines . AddRange ( MakeRectangleLines ( pos , a . MinRangeColor , a . MinRange ) ) ;
if ( a . MaxRange > 0 ) lines . AddRange ( MakeRectangleLines ( pos , a . MaxRangeColor , a . MaxRange ) ) ;
break ;
case ArgumentInfo . ArgumentRenderStyle . NONE :
break ;
default : throw new NotImplementedException ( "Unknown ArgumentRenderStyle" ) ;
}
}
}
2016-07-14 12:42:16 +00:00
2017-01-08 22:04:55 +00:00
return lines ;
}
2016-07-14 12:42:16 +00:00
2017-01-08 22:04:55 +00:00
#endregion
#region = = = = = = = = = = = = = = = = = = GetDynamicLightShapes
2018-02-04 03:16:52 +00:00
public static List < Line3D > GetPointLightShape ( Thing t , bool highlight , GZGeneral . LightData ld , int linealpha )
{
// TODO: this basically duplicates VisualThing.UpdateLight()...
// Determine light radiii
int primaryradius ;
int secondaryradius = 0 ;
if ( ld . LightDef ! = GZGeneral . LightDef . VAVOOM_GENERIC & &
ld . LightDef ! = GZGeneral . LightDef . VAVOOM_COLORED ) //if it's gzdoom light
{
if ( ld . LightModifier = = GZGeneral . LightModifier . SECTOR )
{
if ( t . Sector = = null ) t . DetermineSector ( ) ;
int scaler = ( t . Sector ! = null ? t . Sector . Brightness / 4 : 2 ) ;
primaryradius = t . Args [ 3 ] * scaler ;
}
else
{
primaryradius = t . Args [ 3 ] * 2 ; //works... that.. way in GZDoom
if ( ld . LightAnimated ) secondaryradius = t . Args [ 4 ] * 2 ;
}
}
else //it's one of vavoom lights
{
primaryradius = t . Args [ 0 ] * 8 ;
}
// Check radii...
if ( primaryradius < 1 & & secondaryradius < 1 ) return null ;
// Determine light color
PixelColor color ;
if ( highlight )
{
color = General . Colors . Highlight . WithAlpha ( ( byte ) linealpha ) ;
}
else
{
switch ( t . DynamicLightType . LightDef )
{
case GZGeneral . LightDef . VAVOOM_GENERIC : // Vavoom light
color = new PixelColor ( ( byte ) linealpha , 255 , 255 , 255 ) ;
break ;
case GZGeneral . LightDef . VAVOOM_COLORED : // Vavoom colored light
color = new PixelColor ( ( byte ) linealpha , ( byte ) t . Args [ 1 ] , ( byte ) t . Args [ 2 ] , ( byte ) t . Args [ 3 ] ) ;
break ;
default :
color = new PixelColor ( ( byte ) linealpha , ( byte ) t . Args [ 0 ] , ( byte ) t . Args [ 1 ] , ( byte ) t . Args [ 2 ] ) ;
break ;
}
}
// Add lines if visible
List < Line3D > circles = new List < Line3D > ( ) ;
if ( primaryradius > 0 ) circles . AddRange ( MakeCircleLines ( t . Position , color , primaryradius , CIRCLE_SIDES ) ) ;
if ( secondaryradius > 0 ) circles . AddRange ( MakeCircleLines ( t . Position , color , secondaryradius , CIRCLE_SIDES ) ) ;
return circles ;
}
public static List < Line3D > GetSpotLightShape ( Thing t , bool highlight , GZGeneral . LightData ld , int linealpha )
{
List < Line3D > shapes = new List < Line3D > ( ) ;
float lAngle1 = Angle2D . DegToRad ( t . Args [ 1 ] / 2 ) ;
float lAngle2 = Angle2D . DegToRad ( t . Args [ 2 ] / 2 ) ;
float lRadius = t . Args [ 3 ] ;
float lDirY = ( float ) Math . Sin ( - lAngle1 ) * lRadius ;
float lDirX = ( float ) Math . Cos ( - lAngle1 ) * lRadius ;
shapes . Add ( new Line3D ( new Vector3D ( 0 , 0 , 0 ) , new Vector3D ( lDirX , lDirY , 0 ) ) ) ;
shapes . Add ( new Line3D ( new Vector3D ( 0 , 0 , 0 ) , new Vector3D ( lDirX , - lDirY , 0 ) ) ) ;
return shapes ;
}
public static List < Line3D > GetDynamicLightShapes ( IEnumerable < Thing > things , bool highlight )
2017-01-08 22:04:55 +00:00
{
List < Line3D > circles = new List < Line3D > ( ) ;
if ( General . Map . DOOM ) return circles ;
const int linealpha = 128 ;
foreach ( Thing t in things )
{
2018-02-03 20:31:34 +00:00
GZGeneral . LightData ld = t . DynamicLightType ;
if ( ld = = null ) continue ;
2017-01-08 22:04:55 +00:00
2018-02-04 03:16:52 +00:00
if ( ld . LightType ! = GZGeneral . LightType . SPOT )
{
List < Line3D > lshape = GetPointLightShape ( t , highlight , ld , linealpha ) ;
circles . AddRange ( lshape ) ;
}
else
{
List < Line3D > lshape = GetSpotLightShape ( t , highlight , ld , linealpha ) ;
circles . AddRange ( lshape ) ;
}
2016-07-14 12:42:16 +00:00
}
2017-01-08 22:04:55 +00:00
// Done
return circles ;
}
#endregion
#region = = = = = = = = = = = = = = = = = = GetAmbientSoundShapes
public static List < Line3D > GetAmbientSoundShapes ( IEnumerable < Thing > things , bool highlight )
{
List < Line3D > circles = new List < Line3D > ( ) ;
const int linealpha = 128 ;
foreach ( Thing t in things )
{
ThingTypeInfo info = General . Map . Data . GetThingInfoEx ( t . Type ) ;
if ( info = = null ) continue ;
float minradius , maxradius ;
if ( info . AmbientSound ! = null )
{
minradius = info . AmbientSound . MinimumRadius ;
maxradius = info . AmbientSound . MaximumRadius ;
}
else if ( ! General . Map . DOOM & & ( info . ClassName = = "AmbientSound" | | info . ClassName = = "AmbientSoundNoGravity" ) )
{
//arg0: ambient slot
//arg1: (optional) sound volume, in percent. 1 is nearly silent, 100 and above are full volume. If left to zero, full volume is also used.
//arg2: (optional) minimum distance, in map units, at which volume attenuation begins. Note that arg3 must also be set. If both are left to zero, normal rolloff is used instead.
//arg3: (optional) maximum distance, in map units, at which the sound can be heard. If left to zero or lower than arg2, normal rolloff is used instead.
//arg4: (optional) scalar by which to multiply the values of arg2 and arg3. If left to zero, no multiplication takes place.
if ( t . Args [ 0 ] = = 0 | | ! General . Map . Data . AmbientSounds . ContainsKey ( t . Args [ 0 ] ) )
continue ;
// Use custom radii?
if ( t . Args [ 2 ] > 0 & & t . Args [ 3 ] > 0 & & t . Args [ 3 ] > t . Args [ 2 ] )
{
minradius = t . Args [ 2 ] * ( t . Args [ 4 ] ! = 0 ? t . Args [ 4 ] : 1.0f ) ;
maxradius = t . Args [ 3 ] * ( t . Args [ 4 ] ! = 0 ? t . Args [ 4 ] : 1.0f ) ;
}
else
{
minradius = General . Map . Data . AmbientSounds [ t . Args [ 0 ] ] . MinimumRadius ;
maxradius = General . Map . Data . AmbientSounds [ t . Args [ 0 ] ] . MaximumRadius ;
}
}
else
{
continue ;
}
// Determine color
PixelColor color = ( highlight ? General . Colors . Highlight . WithAlpha ( linealpha ) : t . Color . WithAlpha ( linealpha ) ) ;
// Add lines if visible
if ( minradius > 0 ) circles . AddRange ( MakeCircleLines ( t . Position , color , minradius , CIRCLE_SIDES ) ) ;
if ( maxradius > 0 ) circles . AddRange ( MakeCircleLines ( t . Position , color , maxradius , CIRCLE_SIDES ) ) ;
}
return circles ;
2013-09-11 09:47:53 +00:00
}
2012-09-26 00:04:17 +00:00
2017-01-08 22:04:55 +00:00
#endregion
#region = = = = = = = = = = = = = = = = = = Utility
2015-08-08 21:56:43 +00:00
// Taken from Xabis' "curved interpolation points paths" patch.
private static float SplineLerp ( float u , float p1 , float p2 , float p3 , float p4 )
{
float t2 = u ;
float res = 2 * p2 ;
res + = ( p3 - p1 ) * u ;
t2 * = u ;
res + = ( 2 * p1 - 5 * p2 + 4 * p3 - p4 ) * t2 ;
t2 * = u ;
res + = ( 3 * p2 - 3 * p3 + p4 - p1 ) * t2 ;
return 0.5f * res ;
}
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
// Required only when called from VisualMode
2016-08-01 08:08:57 +00:00
private static float GetCorrectHeight ( Thing thing , VisualBlockMap blockmap , bool usethingcenter )
2014-12-03 23:15:26 +00:00
{
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
if ( blockmap = = null ) return 0f ;
2016-08-01 08:08:57 +00:00
float height = ( usethingcenter ? thing . Height / 2f : 0f ) ;
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
if ( thing . Sector = = null ) thing . DetermineSector ( blockmap ) ;
if ( thing . Sector ! = null ) height + = thing . Sector . FloorHeight ;
2013-09-11 09:47:53 +00:00
return height ;
}
2017-01-08 22:04:55 +00:00
#endregion
2013-09-11 09:47:53 +00:00
}
2012-09-26 00:04:17 +00:00
}