2009-04-19 18:07:22 +00:00
#region = = = = = = = = = = = = = = = = = = Copyright ( c ) 2007 Pascal vd Heiden
/ *
* Copyright ( c ) 2007 Pascal vd Heiden , www . codeimp . com
* This program is released under GNU General Public License
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* /
#endregion
#region = = = = = = = = = = = = = = = = = = Namespaces
using System ;
using System.Collections.Generic ;
2014-10-20 12:16:51 +00:00
using CodeImp.DoomBuilder.Config ;
2009-04-19 18:07:22 +00:00
using CodeImp.DoomBuilder.Data ;
2015-05-27 12:38:03 +00:00
using CodeImp.DoomBuilder.Geometry ;
2013-04-11 11:04:16 +00:00
using CodeImp.DoomBuilder.GZBuilder.Data ; //mxd
2015-05-27 12:38:03 +00:00
using CodeImp.DoomBuilder.Map ;
using CodeImp.DoomBuilder.Rendering ;
using SlimDX ;
using SlimDX.Direct3D9 ;
Fixed, Draw Lines/Rectangle/Circle/Curve modes: line length labels displayed incorrect length.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: line length labels are now displayed the same way as in Draw modes.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: "lock movement to cardinal directions" mode (Alt-Shift-Drag) now locks movement in 4 directions instead of 8 and doesn't snap map elements to nearest grid intersections when they are not aligned to it.
Added, Visual mode, GZDoom, DECORATE: FORCEXYBILLBOARD flag is now supported.
Added, Visual mode, GLOOME, DECORATE: FLOORSPRITE, CEILSPRITE, WALLSPRITE, ROLLSPRITE and STICKTOPLANE flags are now supported (implementation is somewhat broken ATM and probably doesn't work the same way as in GLOOME, because Windows build with most these features is nowhere to be found...).
Fixed, Visual mode: in some cases Thing brightness was calculated incorrectly.
Updated ZDoom_DECORATE.cfg.
2015-08-25 22:05:14 +00:00
using Plane = CodeImp . DoomBuilder . Geometry . Plane ;
2012-04-17 19:13:47 +00:00
2009-04-19 18:07:22 +00:00
#endregion
namespace CodeImp.DoomBuilder.VisualModes
{
2016-02-01 22:04:00 +00:00
public abstract class VisualThing : IVisualPickable , ID3DResource , IDisposable
2009-04-19 18:07:22 +00:00
{
#region = = = = = = = = = = = = = = = = = = Constants
2013-03-18 13:52:27 +00:00
protected const int FIXED_RADIUS = 8 ; //mxd. Used to render things with zero width and radius
2016-09-07 15:15:07 +00:00
private const float DYNLIGHT_INTENSITY_SCALER = 255.0f ;
private const float SUBLIGHT_INTENSITY_SCALER = 255.0f * 1.5f ; // Scaler for subtractive dynamic lights
2013-03-18 13:52:27 +00:00
2009-04-19 18:07:22 +00:00
#endregion
#region = = = = = = = = = = = = = = = = = = Variables
// Thing
Fixed, Draw Lines/Rectangle/Circle/Curve modes: line length labels displayed incorrect length.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: line length labels are now displayed the same way as in Draw modes.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: "lock movement to cardinal directions" mode (Alt-Shift-Drag) now locks movement in 4 directions instead of 8 and doesn't snap map elements to nearest grid intersections when they are not aligned to it.
Added, Visual mode, GZDoom, DECORATE: FORCEXYBILLBOARD flag is now supported.
Added, Visual mode, GLOOME, DECORATE: FLOORSPRITE, CEILSPRITE, WALLSPRITE, ROLLSPRITE and STICKTOPLANE flags are now supported (implementation is somewhat broken ATM and probably doesn't work the same way as in GLOOME, because Windows build with most these features is nowhere to be found...).
Fixed, Visual mode: in some cases Thing brightness was calculated incorrectly.
Updated ZDoom_DECORATE.cfg.
2015-08-25 22:05:14 +00:00
private readonly Thing thing ;
//mxd. Info
protected ThingTypeInfo info ;
2009-04-19 18:07:22 +00:00
2016-04-11 23:05:16 +00:00
// Textures
protected ImageData [ ] textures ;
2009-04-19 18:07:22 +00:00
// Geometry
2016-04-11 23:05:16 +00:00
private WorldVertex [ ] [ ] vertices ;
private VertexBuffer [ ] geobuffers ;
2015-10-02 14:47:34 +00:00
private VertexBuffer cagebuffer ; //mxd
private int cagelength ; //mxd
2009-04-19 18:07:22 +00:00
private bool updategeo ;
Game Configurations: added Vanilla Strife, Vanilla Heretic and Vanilla Hexen game configurations.
Added "makedoorceil" game configuration property. Works the same way as "makedoortrack" and "makedoordoor", but for ceilings of door sectors.
Changed, Game configurations: the editor no longer tries to load DECORATE/MODELDEF/VOXELDEF/GLDEFS/REVERBS lumps when "decorategames" setting is not specified / is set to empty string.
Changed, General interface: "Tools -> Reload MODELDEF/VOXELDEF" and "Tools -> Reload GLDEFS" menu items are no longer shown when current game configuration doesn't support DECORATE.
Fixed a crash when pasting linedef/thing properties in Hexen map format.
Fixed, Visual mode: Visual Thing resources were not fully unloaded when resetting D3D device leading to crash when switching to the editor from a DX-using game engine (like ZDoom) running in fullscreen.
Fixed: in some cases, when current game configuration supported multiple script compilers, it was possible to open/create a map or change map options without selecting any script compiler.
Fixed, New Map Options window: default map name was not updated when switching game configurations.
Fixed: copied map element properties were not reset after switching to another map.
Fixed: stored textures for "Make Door" action were not reset after switching to another map.
Fixed, Game Configurations window: currently selected test engine name was not updated when pasting test engines from another configuration.
Fixed, Game Configurations: all "Heretic in Doom map format" configurations were using Doom sector effects list.
Fixed, Game Configurations: all "Strife in Doom map format" configurations were using Doom sector effects list.
2015-10-21 13:35:42 +00:00
private bool updatecage ; //mxd
2016-04-11 23:05:16 +00:00
private int [ ] triangles ;
private int spriteframe ; //mxd
2009-04-19 18:07:22 +00:00
// Rendering
2015-09-27 21:09:14 +00:00
private RenderPass renderpass ;
2009-04-19 18:07:22 +00:00
private Matrix position ;
2015-09-27 21:09:14 +00:00
private int cameradistance ;
private Color4 cagecolor ;
2013-03-18 13:52:27 +00:00
protected bool sizeless ; //mxd. Used to render visual things with 0 width and height
2015-10-02 14:47:34 +00:00
protected float fogfactor ; //mxd
2009-05-01 20:31:17 +00:00
// Selected?
protected bool selected ;
2009-04-19 18:07:22 +00:00
// Disposing
2014-02-21 14:42:12 +00:00
private bool isdisposed ;
2012-04-17 19:13:47 +00:00
2013-09-11 09:47:53 +00:00
//mxd
2015-10-02 14:47:34 +00:00
protected float thingheight ;
2012-04-17 19:13:47 +00:00
2013-09-11 09:47:53 +00:00
//mxd. light properties
private DynamicLightType lightType ;
private DynamicLightRenderStyle lightRenderStyle ;
private Color4 lightColor ;
private float lightRadius ; //current radius. used in light animation
private float lightPrimaryRadius ;
private float lightSecondaryRadius ;
private Vector3 position_v3 ;
private float lightDelta ; //used in light animation
2015-09-27 21:09:14 +00:00
private Vector3D [ ] boundingBox ;
Fixed, Draw Lines/Rectangle/Circle/Curve modes: line length labels displayed incorrect length.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: line length labels are now displayed the same way as in Draw modes.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: "lock movement to cardinal directions" mode (Alt-Shift-Drag) now locks movement in 4 directions instead of 8 and doesn't snap map elements to nearest grid intersections when they are not aligned to it.
Added, Visual mode, GZDoom, DECORATE: FORCEXYBILLBOARD flag is now supported.
Added, Visual mode, GLOOME, DECORATE: FLOORSPRITE, CEILSPRITE, WALLSPRITE, ROLLSPRITE and STICKTOPLANE flags are now supported (implementation is somewhat broken ATM and probably doesn't work the same way as in GLOOME, because Windows build with most these features is nowhere to be found...).
Fixed, Visual mode: in some cases Thing brightness was calculated incorrectly.
Updated ZDoom_DECORATE.cfg.
2015-08-25 22:05:14 +00:00
2013-09-11 09:47:53 +00:00
//gldefs light
private Vector3 lightOffset ;
private int lightInterval ;
private bool isGldefsLight ;
2009-04-19 18:07:22 +00:00
#endregion
#region = = = = = = = = = = = = = = = = = = Properties
2016-04-11 23:05:16 +00:00
internal VertexBuffer GeometryBuffer { get { return geobuffers [ spriteframe ] ; } }
2015-10-02 14:47:34 +00:00
internal VertexBuffer CageBuffer { get { return cagebuffer ; } } //mxd
internal int CageLength { get { return cagelength ; } } //mxd
2009-04-19 18:07:22 +00:00
internal bool NeedsUpdateGeo { get { return updategeo ; } }
2016-04-11 23:05:16 +00:00
internal int Triangles { get { return triangles [ spriteframe ] ; } }
2009-04-19 18:07:22 +00:00
internal Matrix Position { get { return position ; } }
2015-09-27 21:09:14 +00:00
internal Color4 CageColor { get { return cagecolor ; } }
Fixed, Draw Lines/Rectangle/Circle/Curve modes: line length labels displayed incorrect length.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: line length labels are now displayed the same way as in Draw modes.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: "lock movement to cardinal directions" mode (Alt-Shift-Drag) now locks movement in 4 directions instead of 8 and doesn't snap map elements to nearest grid intersections when they are not aligned to it.
Added, Visual mode, GZDoom, DECORATE: FORCEXYBILLBOARD flag is now supported.
Added, Visual mode, GLOOME, DECORATE: FLOORSPRITE, CEILSPRITE, WALLSPRITE, ROLLSPRITE and STICKTOPLANE flags are now supported (implementation is somewhat broken ATM and probably doesn't work the same way as in GLOOME, because Windows build with most these features is nowhere to be found...).
Fixed, Visual mode: in some cases Thing brightness was calculated incorrectly.
Updated ZDoom_DECORATE.cfg.
2015-08-25 22:05:14 +00:00
public ThingTypeInfo Info { get { return info ; } } //mxd
2013-09-11 09:47:53 +00:00
//mxd
2016-04-11 23:05:16 +00:00
internal int VertexColor { get { return vertices . Length > 0 & & vertices [ 0 ] . Length > 0 ? vertices [ 0 ] [ 0 ] . c : 0 ; } }
2015-09-27 21:09:14 +00:00
public int CameraDistance { get { return cameradistance ; } }
2015-10-02 14:47:34 +00:00
public float FogFactor { get { return fogfactor ; } }
2015-09-27 21:09:14 +00:00
public Vector3 Center
{
get
{
if ( isGldefsLight ) return position_v3 + lightOffset ;
Fixed, Draw Lines/Rectangle/Circle/Curve modes: line length labels displayed incorrect length.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: line length labels are now displayed the same way as in Draw modes.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: "lock movement to cardinal directions" mode (Alt-Shift-Drag) now locks movement in 4 directions instead of 8 and doesn't snap map elements to nearest grid intersections when they are not aligned to it.
Added, Visual mode, GZDoom, DECORATE: FORCEXYBILLBOARD flag is now supported.
Added, Visual mode, GLOOME, DECORATE: FLOORSPRITE, CEILSPRITE, WALLSPRITE, ROLLSPRITE and STICKTOPLANE flags are now supported (implementation is somewhat broken ATM and probably doesn't work the same way as in GLOOME, because Windows build with most these features is nowhere to be found...).
Fixed, Visual mode: in some cases Thing brightness was calculated incorrectly.
Updated ZDoom_DECORATE.cfg.
2015-08-25 22:05:14 +00:00
return new Vector3 ( position_v3 . X , position_v3 . Y , position_v3 . Z + thingheight / 2f ) ;
2013-09-11 09:47:53 +00:00
}
}
2013-08-08 11:04:13 +00:00
public Vector3D CenterV3D { get { return D3DDevice . V3D ( Center ) ; } }
Fixed, Draw Lines/Rectangle/Circle/Curve modes: line length labels displayed incorrect length.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: line length labels are now displayed the same way as in Draw modes.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: "lock movement to cardinal directions" mode (Alt-Shift-Drag) now locks movement in 4 directions instead of 8 and doesn't snap map elements to nearest grid intersections when they are not aligned to it.
Added, Visual mode, GZDoom, DECORATE: FORCEXYBILLBOARD flag is now supported.
Added, Visual mode, GLOOME, DECORATE: FLOORSPRITE, CEILSPRITE, WALLSPRITE, ROLLSPRITE and STICKTOPLANE flags are now supported (implementation is somewhat broken ATM and probably doesn't work the same way as in GLOOME, because Windows build with most these features is nowhere to be found...).
Fixed, Visual mode: in some cases Thing brightness was calculated incorrectly.
Updated ZDoom_DECORATE.cfg.
2015-08-25 22:05:14 +00:00
public float LocalCenterZ { get { return thingheight / 2f ; } } //mxd
2013-09-11 09:47:53 +00:00
public Vector3 PositionV3 { get { return position_v3 ; } }
2015-09-27 21:09:14 +00:00
public Vector3D [ ] BoundingBox { get { return boundingBox ; } }
Added, Visual mode, GLDEFS, GLOOME: subtractive glow is now supported.
Changed, Visual mode: changed thing fog calculation logic. Should be closer to GZDoom now.
Fixed, GLDEFS parser: "height" texture parameter was not treated as optional.
Fixed, text lump parsers: in some cases incorrect line number was displayed in error and warning messages.
Fixed, Visual mode: glow effect was not applied to sectors with 3 sidedefs.
Fixed, Visual mode: in some cases glow effect was not updated when replacing textures.
Fixed, general interface: "Full Brightness" button state was not updated during map loading.
Fixed, Drag Linedefs/Vertices/Sectors/Things modes: positions of line length labels were not updated while panning the view.
Cosmetic: added a bunch of new icons.
Cosmetic: changed Visual mode crosshair.
2015-08-27 20:46:49 +00:00
2013-09-11 09:47:53 +00:00
//mxd. light properties
public DynamicLightType LightType { get { return lightType ; } }
public float LightRadius { get { return lightRadius ; } }
public DynamicLightRenderStyle LightRenderStyle { get { return lightRenderStyle ; } }
public Color4 LightColor { get { return lightColor ; } }
2009-04-19 18:07:22 +00:00
/// <summary>
/// Returns the Thing that this VisualThing is created for.
/// </summary>
public Thing Thing { get { return thing ; } }
/// <summary>
2015-09-27 21:09:14 +00:00
/// Render pass in which this geometry must be rendered. Default is Mask.
2009-04-19 18:07:22 +00:00
/// </summary>
2015-09-27 21:09:14 +00:00
public RenderPass RenderPass { get { return renderpass ; } set { renderpass = value ; } }
2009-04-19 18:07:22 +00:00
/// <summary>
/// Image to use as texture on the geometry.
/// </summary>
2016-04-11 23:05:16 +00:00
public ImageData Texture { get { return textures [ spriteframe ] ; } }
2009-04-19 18:07:22 +00:00
/// <summary>
/// Disposed or not?
/// </summary>
public bool IsDisposed { get { return isdisposed ; } }
2009-05-01 20:31:17 +00:00
/// <summary>
/// Selected or not? This is only used by the core to determine what color to draw it with.
/// </summary>
public bool Selected { get { return selected ; } set { selected = value ; } }
2009-04-19 18:07:22 +00:00
#endregion
#region = = = = = = = = = = = = = = = = = = Constructor / Destructor
// Constructor
2015-05-27 12:38:03 +00:00
protected VisualThing ( Thing t )
2009-04-19 18:07:22 +00:00
{
// Initialize
this . thing = t ;
2015-09-27 21:09:14 +00:00
this . renderpass = RenderPass . Mask ;
2009-04-19 18:07:22 +00:00
this . position = Matrix . Identity ;
2012-04-17 19:13:47 +00:00
2013-09-11 09:47:53 +00:00
//mxd
lightType = DynamicLightType . NONE ;
lightRenderStyle = DynamicLightRenderStyle . NONE ;
lightPrimaryRadius = - 1 ;
lightSecondaryRadius = - 1 ;
lightInterval = - 1 ;
lightColor = new Color4 ( ) ;
2015-09-27 21:09:14 +00:00
boundingBox = new Vector3D [ 9 ] ;
2009-04-19 18:07:22 +00:00
// Register as resource
General . Map . Graphics . RegisterResource ( this ) ;
}
// Disposer
public virtual void Dispose ( )
{
// Not already disposed?
if ( ! isdisposed )
{
// Clean up
2016-04-11 23:05:16 +00:00
if ( geobuffers ! = null ) //mxd
{
foreach ( VertexBuffer buffer in geobuffers ) buffer . Dispose ( ) ;
geobuffers = null ;
}
2015-10-02 14:47:34 +00:00
if ( cagebuffer ! = null ) cagebuffer . Dispose ( ) ; //mxd
cagebuffer = null ; //mxd
2009-04-19 18:07:22 +00:00
// Unregister resource
General . Map . Graphics . UnregisterResource ( this ) ;
// Done
isdisposed = true ;
}
}
#endregion
#region = = = = = = = = = = = = = = = = = = Methods
2012-04-17 19:13:47 +00:00
2013-09-11 09:47:53 +00:00
//mxd
2015-09-27 21:09:14 +00:00
internal void CalculateCameraDistance ( Vector3D campos )
2014-12-03 23:15:26 +00:00
{
2015-09-27 21:09:14 +00:00
cameradistance = ( int ) ( ( CenterV3D - campos ) . GetLengthSq ( ) ) ;
2013-09-11 09:47:53 +00:00
}
2009-04-19 18:07:22 +00:00
2015-09-27 21:09:14 +00:00
// This is called before a device is reset (when resized or display adapter was changed)
2009-04-19 18:07:22 +00:00
public void UnloadResource ( )
{
Game Configurations: added Vanilla Strife, Vanilla Heretic and Vanilla Hexen game configurations.
Added "makedoorceil" game configuration property. Works the same way as "makedoortrack" and "makedoordoor", but for ceilings of door sectors.
Changed, Game configurations: the editor no longer tries to load DECORATE/MODELDEF/VOXELDEF/GLDEFS/REVERBS lumps when "decorategames" setting is not specified / is set to empty string.
Changed, General interface: "Tools -> Reload MODELDEF/VOXELDEF" and "Tools -> Reload GLDEFS" menu items are no longer shown when current game configuration doesn't support DECORATE.
Fixed a crash when pasting linedef/thing properties in Hexen map format.
Fixed, Visual mode: Visual Thing resources were not fully unloaded when resetting D3D device leading to crash when switching to the editor from a DX-using game engine (like ZDoom) running in fullscreen.
Fixed: in some cases, when current game configuration supported multiple script compilers, it was possible to open/create a map or change map options without selecting any script compiler.
Fixed, New Map Options window: default map name was not updated when switching game configurations.
Fixed: copied map element properties were not reset after switching to another map.
Fixed: stored textures for "Make Door" action were not reset after switching to another map.
Fixed, Game Configurations window: currently selected test engine name was not updated when pasting test engines from another configuration.
Fixed, Game Configurations: all "Heretic in Doom map format" configurations were using Doom sector effects list.
Fixed, Game Configurations: all "Strife in Doom map format" configurations were using Doom sector effects list.
2015-10-21 13:35:42 +00:00
// Trash geometry buffers
2016-04-11 23:05:16 +00:00
if ( geobuffers ! = null ) //mxd
{
foreach ( VertexBuffer buffer in geobuffers ) buffer . Dispose ( ) ;
geobuffers = null ;
}
Game Configurations: added Vanilla Strife, Vanilla Heretic and Vanilla Hexen game configurations.
Added "makedoorceil" game configuration property. Works the same way as "makedoortrack" and "makedoordoor", but for ceilings of door sectors.
Changed, Game configurations: the editor no longer tries to load DECORATE/MODELDEF/VOXELDEF/GLDEFS/REVERBS lumps when "decorategames" setting is not specified / is set to empty string.
Changed, General interface: "Tools -> Reload MODELDEF/VOXELDEF" and "Tools -> Reload GLDEFS" menu items are no longer shown when current game configuration doesn't support DECORATE.
Fixed a crash when pasting linedef/thing properties in Hexen map format.
Fixed, Visual mode: Visual Thing resources were not fully unloaded when resetting D3D device leading to crash when switching to the editor from a DX-using game engine (like ZDoom) running in fullscreen.
Fixed: in some cases, when current game configuration supported multiple script compilers, it was possible to open/create a map or change map options without selecting any script compiler.
Fixed, New Map Options window: default map name was not updated when switching game configurations.
Fixed: copied map element properties were not reset after switching to another map.
Fixed: stored textures for "Make Door" action were not reset after switching to another map.
Fixed, Game Configurations window: currently selected test engine name was not updated when pasting test engines from another configuration.
Fixed, Game Configurations: all "Heretic in Doom map format" configurations were using Doom sector effects list.
Fixed, Game Configurations: all "Strife in Doom map format" configurations were using Doom sector effects list.
2015-10-21 13:35:42 +00:00
if ( cagebuffer ! = null ) cagebuffer . Dispose ( ) ; //mxd
cagebuffer = null ; //mxd
2009-04-19 18:07:22 +00:00
updategeo = true ;
Game Configurations: added Vanilla Strife, Vanilla Heretic and Vanilla Hexen game configurations.
Added "makedoorceil" game configuration property. Works the same way as "makedoortrack" and "makedoordoor", but for ceilings of door sectors.
Changed, Game configurations: the editor no longer tries to load DECORATE/MODELDEF/VOXELDEF/GLDEFS/REVERBS lumps when "decorategames" setting is not specified / is set to empty string.
Changed, General interface: "Tools -> Reload MODELDEF/VOXELDEF" and "Tools -> Reload GLDEFS" menu items are no longer shown when current game configuration doesn't support DECORATE.
Fixed a crash when pasting linedef/thing properties in Hexen map format.
Fixed, Visual mode: Visual Thing resources were not fully unloaded when resetting D3D device leading to crash when switching to the editor from a DX-using game engine (like ZDoom) running in fullscreen.
Fixed: in some cases, when current game configuration supported multiple script compilers, it was possible to open/create a map or change map options without selecting any script compiler.
Fixed, New Map Options window: default map name was not updated when switching game configurations.
Fixed: copied map element properties were not reset after switching to another map.
Fixed: stored textures for "Make Door" action were not reset after switching to another map.
Fixed, Game Configurations window: currently selected test engine name was not updated when pasting test engines from another configuration.
Fixed, Game Configurations: all "Heretic in Doom map format" configurations were using Doom sector effects list.
Fixed, Game Configurations: all "Strife in Doom map format" configurations were using Doom sector effects list.
2015-10-21 13:35:42 +00:00
updatecage = true ; //mxd
2009-04-19 18:07:22 +00:00
}
// This is called resets when the device is reset
// (when resized or display adapter was changed)
public void ReloadResource ( )
{
// Make new geometry
//Update();
}
/// <summary>
2015-10-09 21:57:32 +00:00
/// Sets the color of the cage around the thing geometry and rebuilds the thing cage.
2009-04-19 18:07:22 +00:00
/// </summary>
Game Configurations: added Vanilla Strife, Vanilla Heretic and Vanilla Hexen game configurations.
Added "makedoorceil" game configuration property. Works the same way as "makedoortrack" and "makedoordoor", but for ceilings of door sectors.
Changed, Game configurations: the editor no longer tries to load DECORATE/MODELDEF/VOXELDEF/GLDEFS/REVERBS lumps when "decorategames" setting is not specified / is set to empty string.
Changed, General interface: "Tools -> Reload MODELDEF/VOXELDEF" and "Tools -> Reload GLDEFS" menu items are no longer shown when current game configuration doesn't support DECORATE.
Fixed a crash when pasting linedef/thing properties in Hexen map format.
Fixed, Visual mode: Visual Thing resources were not fully unloaded when resetting D3D device leading to crash when switching to the editor from a DX-using game engine (like ZDoom) running in fullscreen.
Fixed: in some cases, when current game configuration supported multiple script compilers, it was possible to open/create a map or change map options without selecting any script compiler.
Fixed, New Map Options window: default map name was not updated when switching game configurations.
Fixed: copied map element properties were not reset after switching to another map.
Fixed: stored textures for "Make Door" action were not reset after switching to another map.
Fixed, Game Configurations window: currently selected test engine name was not updated when pasting test engines from another configuration.
Fixed, Game Configurations: all "Heretic in Doom map format" configurations were using Doom sector effects list.
Fixed, Game Configurations: all "Strife in Doom map format" configurations were using Doom sector effects list.
2015-10-21 13:35:42 +00:00
protected void SetCageColor ( PixelColor color )
2009-04-19 18:07:22 +00:00
{
2015-09-27 21:09:14 +00:00
cagecolor = color . ToColorValue ( ) ;
Game Configurations: added Vanilla Strife, Vanilla Heretic and Vanilla Hexen game configurations.
Added "makedoorceil" game configuration property. Works the same way as "makedoortrack" and "makedoordoor", but for ceilings of door sectors.
Changed, Game configurations: the editor no longer tries to load DECORATE/MODELDEF/VOXELDEF/GLDEFS/REVERBS lumps when "decorategames" setting is not specified / is set to empty string.
Changed, General interface: "Tools -> Reload MODELDEF/VOXELDEF" and "Tools -> Reload GLDEFS" menu items are no longer shown when current game configuration doesn't support DECORATE.
Fixed a crash when pasting linedef/thing properties in Hexen map format.
Fixed, Visual mode: Visual Thing resources were not fully unloaded when resetting D3D device leading to crash when switching to the editor from a DX-using game engine (like ZDoom) running in fullscreen.
Fixed: in some cases, when current game configuration supported multiple script compilers, it was possible to open/create a map or change map options without selecting any script compiler.
Fixed, New Map Options window: default map name was not updated when switching game configurations.
Fixed: copied map element properties were not reset after switching to another map.
Fixed: stored textures for "Make Door" action were not reset after switching to another map.
Fixed, Game Configurations window: currently selected test engine name was not updated when pasting test engines from another configuration.
Fixed, Game Configurations: all "Heretic in Doom map format" configurations were using Doom sector effects list.
Fixed, Game Configurations: all "Strife in Doom map format" configurations were using Doom sector effects list.
2015-10-21 13:35:42 +00:00
updatecage = true ;
2009-04-19 18:07:22 +00:00
}
/// <summary>
/// This sets the position to use for the thing geometry.
/// </summary>
public void SetPosition ( Vector3D pos )
{
2014-12-10 22:50:16 +00:00
position_v3 = D3DDevice . V3 ( pos ) ; //mxd
2013-09-11 09:47:53 +00:00
position = Matrix . Translation ( position_v3 ) ;
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
updategeo = true ;
Game Configurations: added Vanilla Strife, Vanilla Heretic and Vanilla Hexen game configurations.
Added "makedoorceil" game configuration property. Works the same way as "makedoortrack" and "makedoordoor", but for ceilings of door sectors.
Changed, Game configurations: the editor no longer tries to load DECORATE/MODELDEF/VOXELDEF/GLDEFS/REVERBS lumps when "decorategames" setting is not specified / is set to empty string.
Changed, General interface: "Tools -> Reload MODELDEF/VOXELDEF" and "Tools -> Reload GLDEFS" menu items are no longer shown when current game configuration doesn't support DECORATE.
Fixed a crash when pasting linedef/thing properties in Hexen map format.
Fixed, Visual mode: Visual Thing resources were not fully unloaded when resetting D3D device leading to crash when switching to the editor from a DX-using game engine (like ZDoom) running in fullscreen.
Fixed: in some cases, when current game configuration supported multiple script compilers, it was possible to open/create a map or change map options without selecting any script compiler.
Fixed, New Map Options window: default map name was not updated when switching game configurations.
Fixed: copied map element properties were not reset after switching to another map.
Fixed: stored textures for "Make Door" action were not reset after switching to another map.
Fixed, Game Configurations window: currently selected test engine name was not updated when pasting test engines from another configuration.
Fixed, Game Configurations: all "Heretic in Doom map format" configurations were using Doom sector effects list.
Fixed, Game Configurations: all "Strife in Doom map format" configurations were using Doom sector effects list.
2015-10-21 13:35:42 +00:00
updatecage = true ; //mxd
2013-09-11 09:47:53 +00:00
2015-06-22 19:52:23 +00:00
//mxd. update bounding box?
if ( lightType ! = DynamicLightType . NONE & & lightRadius > thing . Size )
2014-12-03 23:15:26 +00:00
{
UpdateBoundingBox ( lightRadius , lightRadius * 2 ) ;
}
2009-04-19 18:07:22 +00:00
}
// This sets the vertices for the thing sprite
2016-07-13 21:53:48 +00:00
protected void SetVertices ( WorldVertex [ ] [ ] verts , Vector2D [ ] offsets /*, Plane floor, Plane ceiling*/ )
2009-04-19 18:07:22 +00:00
{
2013-09-11 09:47:53 +00:00
// Copy vertices
2016-04-11 23:05:16 +00:00
vertices = new WorldVertex [ verts . Length ] [ ] ;
triangles = new int [ verts . Length ] ;
//mxd
for ( int i = 0 ; i < verts . Length ; i + + )
{
vertices [ i ] = new WorldVertex [ verts [ i ] . Length ] ;
verts [ i ] . CopyTo ( vertices [ i ] , 0 ) ;
triangles [ i ] = vertices [ i ] . Length / 3 ;
}
2009-04-19 18:07:22 +00:00
updategeo = true ;
Fixed, Draw Lines/Rectangle/Circle/Curve modes: line length labels displayed incorrect length.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: line length labels are now displayed the same way as in Draw modes.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: "lock movement to cardinal directions" mode (Alt-Shift-Drag) now locks movement in 4 directions instead of 8 and doesn't snap map elements to nearest grid intersections when they are not aligned to it.
Added, Visual mode, GZDoom, DECORATE: FORCEXYBILLBOARD flag is now supported.
Added, Visual mode, GLOOME, DECORATE: FLOORSPRITE, CEILSPRITE, WALLSPRITE, ROLLSPRITE and STICKTOPLANE flags are now supported (implementation is somewhat broken ATM and probably doesn't work the same way as in GLOOME, because Windows build with most these features is nowhere to be found...).
Fixed, Visual mode: in some cases Thing brightness was calculated incorrectly.
Updated ZDoom_DECORATE.cfg.
2015-08-25 22:05:14 +00:00
2016-07-04 18:25:47 +00:00
//mxd. Do some special GZDoom rendering shenanigans...
2016-04-11 23:05:16 +00:00
for ( int c = 0 ; c < vertices . Length ; c + + )
Fixed, Draw Lines/Rectangle/Circle/Curve modes: line length labels displayed incorrect length.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: line length labels are now displayed the same way as in Draw modes.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: "lock movement to cardinal directions" mode (Alt-Shift-Drag) now locks movement in 4 directions instead of 8 and doesn't snap map elements to nearest grid intersections when they are not aligned to it.
Added, Visual mode, GZDoom, DECORATE: FORCEXYBILLBOARD flag is now supported.
Added, Visual mode, GLOOME, DECORATE: FLOORSPRITE, CEILSPRITE, WALLSPRITE, ROLLSPRITE and STICKTOPLANE flags are now supported (implementation is somewhat broken ATM and probably doesn't work the same way as in GLOOME, because Windows build with most these features is nowhere to be found...).
Fixed, Visual mode: in some cases Thing brightness was calculated incorrectly.
Updated ZDoom_DECORATE.cfg.
2015-08-25 22:05:14 +00:00
{
2016-04-11 23:05:16 +00:00
if ( triangles [ c ] < 2 ) continue ;
2016-07-13 21:53:48 +00:00
2016-07-04 18:25:47 +00:00
Matrix transform , rotation ;
2016-07-13 21:53:48 +00:00
float centerx , centerz ;
// ROLLCENTER flag support
if ( info . RollSprite & & info . RollCenter & & thing . Roll ! = 0 )
{
// Rotate around sprite center
centerx = offsets [ c ] . x ;
centerz = vertices [ c ] [ 1 ] . z * 0.5f - offsets [ c ] . y ;
}
else
{
// Sprite center is already where it needs to be
centerx = 0f ;
centerz = 0f ;
}
Fixed, Draw Lines/Rectangle/Circle/Curve modes: line length labels displayed incorrect length.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: line length labels are now displayed the same way as in Draw modes.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: "lock movement to cardinal directions" mode (Alt-Shift-Drag) now locks movement in 4 directions instead of 8 and doesn't snap map elements to nearest grid intersections when they are not aligned to it.
Added, Visual mode, GZDoom, DECORATE: FORCEXYBILLBOARD flag is now supported.
Added, Visual mode, GLOOME, DECORATE: FLOORSPRITE, CEILSPRITE, WALLSPRITE, ROLLSPRITE and STICKTOPLANE flags are now supported (implementation is somewhat broken ATM and probably doesn't work the same way as in GLOOME, because Windows build with most these features is nowhere to be found...).
Fixed, Visual mode: in some cases Thing brightness was calculated incorrectly.
Updated ZDoom_DECORATE.cfg.
2015-08-25 22:05:14 +00:00
2016-07-04 18:25:47 +00:00
switch ( thing . RenderMode )
2016-04-11 23:05:16 +00:00
{
2016-07-04 18:25:47 +00:00
// Don't do anything
case ThingRenderMode . MODEL : break ;
2016-07-11 22:13:43 +00:00
case ThingRenderMode . VOXEL : break ;
2016-07-04 18:25:47 +00:00
// Actor becomes a flat sprite which can be tilted with the use of the Pitch actor property.
case ThingRenderMode . FLATSPRITE :
2016-07-13 21:53:48 +00:00
transform = Matrix . Identity ;
// Apply roll
if ( info . RollSprite & & thing . Roll ! = 0 )
{
if ( info . RollCenter )
{
rotation = Matrix . RotationY ( - thing . RollRad ) ;
transform = Matrix . Translation ( - centerx , - centerx , - centerz ) * rotation * Matrix . Translation ( centerx , centerx , centerz ) ;
}
else
{
// Sprite center is already where it needs to be
transform = Matrix . RotationY ( - thing . RollRad ) ;
}
}
// Pitch should be performed from the center of the sprite regardless of ROLLCENTER flag...
if ( thing . Pitch ! = 0 )
{
float localcenterz = vertices [ c ] [ 1 ] . z * 0.5f ;
rotation = Matrix . RotationX ( - thing . PitchRad ) ;
transform * = Matrix . Translation ( 0f , 0f , - localcenterz ) * rotation * Matrix . Translation ( 0f , 0f , localcenterz ) ;
}
// Add thing angle into the mix
transform * = Matrix . RotationZ ( thing . Angle ) ;
// Apply transform
2016-04-11 23:05:16 +00:00
for ( int i = 0 ; i < vertices [ c ] . Length ; i + + )
{
2016-07-04 18:25:47 +00:00
Vector4 transformed = Vector3 . Transform ( new Vector3 ( vertices [ c ] [ i ] . x , vertices [ c ] [ i ] . y , vertices [ c ] [ i ] . z ) , transform ) ;
vertices [ c ] [ i ] . x = transformed . X ;
vertices [ c ] [ i ] . y = transformed . Y ;
vertices [ c ] [ i ] . z = transformed . Z ;
}
break ;
// Similar to FLATSPRITE but is not affected by pitch.
case ThingRenderMode . WALLSPRITE :
2016-07-13 21:53:48 +00:00
// Apply sprite roll?
if ( info . RollSprite & & thing . Roll ! = 0 )
{
rotation = Matrix . RotationY ( - thing . RollRad ) * Matrix . RotationZ ( thing . Angle ) ;
if ( info . RollCenter )
transform = Matrix . Translation ( - centerx , - centerx , - centerz ) * rotation * Matrix . Translation ( centerx , centerx , centerz ) ;
else
transform = rotation ; // Sprite center is already where it needs to be
}
else
{
transform = Matrix . RotationZ ( thing . Angle ) ;
}
// Apply transform
2016-07-04 18:25:47 +00:00
for ( int i = 0 ; i < vertices [ c ] . Length ; i + + )
{
Vector4 transformed = Vector3 . Transform ( new Vector3 ( vertices [ c ] [ i ] . x , vertices [ c ] [ i ] . y , vertices [ c ] [ i ] . z ) , transform ) ;
2016-04-11 23:05:16 +00:00
vertices [ c ] [ i ] . x = transformed . X ;
vertices [ c ] [ i ] . y = transformed . Y ;
vertices [ c ] [ i ] . z = transformed . Z ;
}
break ;
2015-08-31 22:06:44 +00:00
2016-07-13 21:53:48 +00:00
#region Some old GLOOME FLOOR_SPRITE / CEILING_SPRITE support code
2016-07-04 18:25:47 +00:00
/ * case Thing . SpriteRenderMode . FLOOR_SPRITE :
2016-04-11 23:05:16 +00:00
Matrix floorrotation = Matrix . RotationZ ( info . RollSprite ? Thing . RollRad : 0f )
* Matrix . RotationY ( Thing . Angle )
* Matrix . RotationX ( Angle2D . PIHALF ) ;
Fixed, Draw Lines/Rectangle/Circle/Curve modes: line length labels displayed incorrect length.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: line length labels are now displayed the same way as in Draw modes.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: "lock movement to cardinal directions" mode (Alt-Shift-Drag) now locks movement in 4 directions instead of 8 and doesn't snap map elements to nearest grid intersections when they are not aligned to it.
Added, Visual mode, GZDoom, DECORATE: FORCEXYBILLBOARD flag is now supported.
Added, Visual mode, GLOOME, DECORATE: FLOORSPRITE, CEILSPRITE, WALLSPRITE, ROLLSPRITE and STICKTOPLANE flags are now supported (implementation is somewhat broken ATM and probably doesn't work the same way as in GLOOME, because Windows build with most these features is nowhere to be found...).
Fixed, Visual mode: in some cases Thing brightness was calculated incorrectly.
Updated ZDoom_DECORATE.cfg.
2015-08-25 22:05:14 +00:00
2016-04-11 23:05:16 +00:00
m = Matrix . Translation ( 0f , 0f , - localcenterz ) * floorrotation * Matrix . Translation ( 0f , 0f , localcenterz ) ;
Fixed, Draw Lines/Rectangle/Circle/Curve modes: line length labels displayed incorrect length.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: line length labels are now displayed the same way as in Draw modes.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: "lock movement to cardinal directions" mode (Alt-Shift-Drag) now locks movement in 4 directions instead of 8 and doesn't snap map elements to nearest grid intersections when they are not aligned to it.
Added, Visual mode, GZDoom, DECORATE: FORCEXYBILLBOARD flag is now supported.
Added, Visual mode, GLOOME, DECORATE: FLOORSPRITE, CEILSPRITE, WALLSPRITE, ROLLSPRITE and STICKTOPLANE flags are now supported (implementation is somewhat broken ATM and probably doesn't work the same way as in GLOOME, because Windows build with most these features is nowhere to be found...).
Fixed, Visual mode: in some cases Thing brightness was calculated incorrectly.
Updated ZDoom_DECORATE.cfg.
2015-08-25 22:05:14 +00:00
2016-04-11 23:05:16 +00:00
for ( int i = 0 ; i < vertices [ c ] . Length ; i + + )
Fixed, Draw Lines/Rectangle/Circle/Curve modes: line length labels displayed incorrect length.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: line length labels are now displayed the same way as in Draw modes.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: "lock movement to cardinal directions" mode (Alt-Shift-Drag) now locks movement in 4 directions instead of 8 and doesn't snap map elements to nearest grid intersections when they are not aligned to it.
Added, Visual mode, GZDoom, DECORATE: FORCEXYBILLBOARD flag is now supported.
Added, Visual mode, GLOOME, DECORATE: FLOORSPRITE, CEILSPRITE, WALLSPRITE, ROLLSPRITE and STICKTOPLANE flags are now supported (implementation is somewhat broken ATM and probably doesn't work the same way as in GLOOME, because Windows build with most these features is nowhere to be found...).
Fixed, Visual mode: in some cases Thing brightness was calculated incorrectly.
Updated ZDoom_DECORATE.cfg.
2015-08-25 22:05:14 +00:00
{
2016-04-11 23:05:16 +00:00
Vector4 transformed = Vector3 . Transform ( new Vector3 ( vertices [ c ] [ i ] . x , vertices [ c ] [ i ] . y , vertices [ c ] [ i ] . z ) , m ) ;
vertices [ c ] [ i ] . x = transformed . X ;
vertices [ c ] [ i ] . y = transformed . Y ;
vertices [ c ] [ i ] . z = transformed . Z ;
}
// TODO: this won't work on things with AbsoluteZ flag
// TODO: +ROLLSPRITE implies +STICKTOPLANE?
if ( info . StickToPlane | | info . RollSprite )
{
// Calculate vertical offset
float floorz = floor . GetZ ( Thing . Position ) ;
float ceilz = ceiling . GetZ ( Thing . Position ) ;
if ( ! float . IsNaN ( floorz ) & & ! float . IsNaN ( ceilz ) )
Fixed, Draw Lines/Rectangle/Circle/Curve modes: line length labels displayed incorrect length.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: line length labels are now displayed the same way as in Draw modes.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: "lock movement to cardinal directions" mode (Alt-Shift-Drag) now locks movement in 4 directions instead of 8 and doesn't snap map elements to nearest grid intersections when they are not aligned to it.
Added, Visual mode, GZDoom, DECORATE: FORCEXYBILLBOARD flag is now supported.
Added, Visual mode, GLOOME, DECORATE: FLOORSPRITE, CEILSPRITE, WALLSPRITE, ROLLSPRITE and STICKTOPLANE flags are now supported (implementation is somewhat broken ATM and probably doesn't work the same way as in GLOOME, because Windows build with most these features is nowhere to be found...).
Fixed, Visual mode: in some cases Thing brightness was calculated incorrectly.
Updated ZDoom_DECORATE.cfg.
2015-08-25 22:05:14 +00:00
{
2016-04-11 23:05:16 +00:00
float voffset ;
if ( info . Hangs )
{
float thingz = ceilz - Thing . Position . z + Thing . Height ;
voffset = 0.01f - floorz - General . Clamp ( thingz , 0 , ceilz - floorz ) ;
}
else
{
voffset = 0.01f - floorz - General . Clamp ( Thing . Position . z , 0 , ceilz - floorz ) ;
}
// Apply it
for ( int i = 0 ; i < vertices [ c ] . Length ; i + + )
vertices [ c ] [ i ] . z = floor . GetZ ( vertices [ c ] [ i ] . x + Thing . Position . x , vertices [ c ] [ i ] . y + Thing . Position . y ) + voffset ;
Fixed, Draw Lines/Rectangle/Circle/Curve modes: line length labels displayed incorrect length.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: line length labels are now displayed the same way as in Draw modes.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: "lock movement to cardinal directions" mode (Alt-Shift-Drag) now locks movement in 4 directions instead of 8 and doesn't snap map elements to nearest grid intersections when they are not aligned to it.
Added, Visual mode, GZDoom, DECORATE: FORCEXYBILLBOARD flag is now supported.
Added, Visual mode, GLOOME, DECORATE: FLOORSPRITE, CEILSPRITE, WALLSPRITE, ROLLSPRITE and STICKTOPLANE flags are now supported (implementation is somewhat broken ATM and probably doesn't work the same way as in GLOOME, because Windows build with most these features is nowhere to be found...).
Fixed, Visual mode: in some cases Thing brightness was calculated incorrectly.
Updated ZDoom_DECORATE.cfg.
2015-08-25 22:05:14 +00:00
}
}
2016-04-11 23:05:16 +00:00
break ;
Fixed, Draw Lines/Rectangle/Circle/Curve modes: line length labels displayed incorrect length.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: line length labels are now displayed the same way as in Draw modes.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: "lock movement to cardinal directions" mode (Alt-Shift-Drag) now locks movement in 4 directions instead of 8 and doesn't snap map elements to nearest grid intersections when they are not aligned to it.
Added, Visual mode, GZDoom, DECORATE: FORCEXYBILLBOARD flag is now supported.
Added, Visual mode, GLOOME, DECORATE: FLOORSPRITE, CEILSPRITE, WALLSPRITE, ROLLSPRITE and STICKTOPLANE flags are now supported (implementation is somewhat broken ATM and probably doesn't work the same way as in GLOOME, because Windows build with most these features is nowhere to be found...).
Fixed, Visual mode: in some cases Thing brightness was calculated incorrectly.
Updated ZDoom_DECORATE.cfg.
2015-08-25 22:05:14 +00:00
2016-04-11 23:05:16 +00:00
case Thing . SpriteRenderMode . CEILING_SPRITE :
Matrix ceilrotation = Matrix . RotationZ ( info . RollSprite ? Thing . RollRad : 0f )
* Matrix . RotationY ( Thing . Angle )
* Matrix . RotationX ( Angle2D . PIHALF ) ;
2015-08-31 22:06:44 +00:00
2016-04-11 23:05:16 +00:00
m = Matrix . Translation ( 0f , 0f , - localcenterz ) * ceilrotation * Matrix . Translation ( 0f , 0f , localcenterz ) ;
Fixed, Draw Lines/Rectangle/Circle/Curve modes: line length labels displayed incorrect length.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: line length labels are now displayed the same way as in Draw modes.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: "lock movement to cardinal directions" mode (Alt-Shift-Drag) now locks movement in 4 directions instead of 8 and doesn't snap map elements to nearest grid intersections when they are not aligned to it.
Added, Visual mode, GZDoom, DECORATE: FORCEXYBILLBOARD flag is now supported.
Added, Visual mode, GLOOME, DECORATE: FLOORSPRITE, CEILSPRITE, WALLSPRITE, ROLLSPRITE and STICKTOPLANE flags are now supported (implementation is somewhat broken ATM and probably doesn't work the same way as in GLOOME, because Windows build with most these features is nowhere to be found...).
Fixed, Visual mode: in some cases Thing brightness was calculated incorrectly.
Updated ZDoom_DECORATE.cfg.
2015-08-25 22:05:14 +00:00
2016-04-11 23:05:16 +00:00
for ( int i = 0 ; i < vertices [ c ] . Length ; i + + )
Fixed, Draw Lines/Rectangle/Circle/Curve modes: line length labels displayed incorrect length.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: line length labels are now displayed the same way as in Draw modes.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: "lock movement to cardinal directions" mode (Alt-Shift-Drag) now locks movement in 4 directions instead of 8 and doesn't snap map elements to nearest grid intersections when they are not aligned to it.
Added, Visual mode, GZDoom, DECORATE: FORCEXYBILLBOARD flag is now supported.
Added, Visual mode, GLOOME, DECORATE: FLOORSPRITE, CEILSPRITE, WALLSPRITE, ROLLSPRITE and STICKTOPLANE flags are now supported (implementation is somewhat broken ATM and probably doesn't work the same way as in GLOOME, because Windows build with most these features is nowhere to be found...).
Fixed, Visual mode: in some cases Thing brightness was calculated incorrectly.
Updated ZDoom_DECORATE.cfg.
2015-08-25 22:05:14 +00:00
{
2016-04-11 23:05:16 +00:00
Vector4 transformed = Vector3 . Transform ( new Vector3 ( vertices [ c ] [ i ] . x , vertices [ c ] [ i ] . y , vertices [ c ] [ i ] . z ) , m ) ;
vertices [ c ] [ i ] . x = transformed . X ;
vertices [ c ] [ i ] . y = transformed . Y ;
vertices [ c ] [ i ] . z = transformed . Z ;
}
// TODO: this won't work on things with AbsoluteZ flag
// TODO: +ROLLSPRITE implies +STICKTOPLANE?
if ( info . StickToPlane | | info . RollSprite )
{
// Calculate vertical offset
float floorz = floor . GetZ ( Thing . Position ) ;
float ceilz = ceiling . GetZ ( Thing . Position ) ;
if ( ! float . IsNaN ( floorz ) & & ! float . IsNaN ( ceilz ) )
Fixed, Draw Lines/Rectangle/Circle/Curve modes: line length labels displayed incorrect length.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: line length labels are now displayed the same way as in Draw modes.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: "lock movement to cardinal directions" mode (Alt-Shift-Drag) now locks movement in 4 directions instead of 8 and doesn't snap map elements to nearest grid intersections when they are not aligned to it.
Added, Visual mode, GZDoom, DECORATE: FORCEXYBILLBOARD flag is now supported.
Added, Visual mode, GLOOME, DECORATE: FLOORSPRITE, CEILSPRITE, WALLSPRITE, ROLLSPRITE and STICKTOPLANE flags are now supported (implementation is somewhat broken ATM and probably doesn't work the same way as in GLOOME, because Windows build with most these features is nowhere to be found...).
Fixed, Visual mode: in some cases Thing brightness was calculated incorrectly.
Updated ZDoom_DECORATE.cfg.
2015-08-25 22:05:14 +00:00
{
2016-04-11 23:05:16 +00:00
float voffset ;
if ( info . Hangs )
{
float thingz = ceilz - Math . Max ( 0 , Thing . Position . z ) - Thing . Height ;
voffset = - 0.01f - General . Clamp ( thingz , 0 , ceilz - floorz ) ;
}
else
{
voffset = - 0.01f - floorz - General . Clamp ( Thing . Position . z , 0 , ceilz - floorz ) ;
}
// Apply it
for ( int i = 0 ; i < vertices [ c ] . Length ; i + + )
vertices [ c ] [ i ] . z = ceiling . GetZ ( vertices [ c ] [ i ] . x + Thing . Position . x , vertices [ c ] [ i ] . y + Thing . Position . y ) + voffset ;
Fixed, Draw Lines/Rectangle/Circle/Curve modes: line length labels displayed incorrect length.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: line length labels are now displayed the same way as in Draw modes.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: "lock movement to cardinal directions" mode (Alt-Shift-Drag) now locks movement in 4 directions instead of 8 and doesn't snap map elements to nearest grid intersections when they are not aligned to it.
Added, Visual mode, GZDoom, DECORATE: FORCEXYBILLBOARD flag is now supported.
Added, Visual mode, GLOOME, DECORATE: FLOORSPRITE, CEILSPRITE, WALLSPRITE, ROLLSPRITE and STICKTOPLANE flags are now supported (implementation is somewhat broken ATM and probably doesn't work the same way as in GLOOME, because Windows build with most these features is nowhere to be found...).
Fixed, Visual mode: in some cases Thing brightness was calculated incorrectly.
Updated ZDoom_DECORATE.cfg.
2015-08-25 22:05:14 +00:00
}
}
2016-07-04 18:25:47 +00:00
break ; * /
2016-07-13 21:53:48 +00:00
#endregion
Fixed, Draw Lines/Rectangle/Circle/Curve modes: line length labels displayed incorrect length.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: line length labels are now displayed the same way as in Draw modes.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: "lock movement to cardinal directions" mode (Alt-Shift-Drag) now locks movement in 4 directions instead of 8 and doesn't snap map elements to nearest grid intersections when they are not aligned to it.
Added, Visual mode, GZDoom, DECORATE: FORCEXYBILLBOARD flag is now supported.
Added, Visual mode, GLOOME, DECORATE: FLOORSPRITE, CEILSPRITE, WALLSPRITE, ROLLSPRITE and STICKTOPLANE flags are now supported (implementation is somewhat broken ATM and probably doesn't work the same way as in GLOOME, because Windows build with most these features is nowhere to be found...).
Fixed, Visual mode: in some cases Thing brightness was calculated incorrectly.
Updated ZDoom_DECORATE.cfg.
2015-08-25 22:05:14 +00:00
2016-07-11 22:13:43 +00:00
case ThingRenderMode . NORMAL :
2016-07-13 21:53:48 +00:00
if ( info . RollSprite & & thing . Roll ! = 0 )
Fixed, Draw Lines/Rectangle/Circle/Curve modes: line length labels displayed incorrect length.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: line length labels are now displayed the same way as in Draw modes.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: "lock movement to cardinal directions" mode (Alt-Shift-Drag) now locks movement in 4 directions instead of 8 and doesn't snap map elements to nearest grid intersections when they are not aligned to it.
Added, Visual mode, GZDoom, DECORATE: FORCEXYBILLBOARD flag is now supported.
Added, Visual mode, GLOOME, DECORATE: FLOORSPRITE, CEILSPRITE, WALLSPRITE, ROLLSPRITE and STICKTOPLANE flags are now supported (implementation is somewhat broken ATM and probably doesn't work the same way as in GLOOME, because Windows build with most these features is nowhere to be found...).
Fixed, Visual mode: in some cases Thing brightness was calculated incorrectly.
Updated ZDoom_DECORATE.cfg.
2015-08-25 22:05:14 +00:00
{
2016-07-13 21:53:48 +00:00
rotation = Matrix . RotationY ( - thing . RollRad ) ;
if ( info . RollCenter )
transform = Matrix . Translation ( - centerx , - centerx , - centerz ) * rotation * Matrix . Translation ( centerx , centerx , centerz ) ;
else
transform = rotation ; // Sprite center is already where it needs to be
// Apply transform
2016-04-11 23:05:16 +00:00
for ( int i = 0 ; i < vertices [ c ] . Length ; i + + )
{
2016-07-04 18:25:47 +00:00
Vector4 transformed = Vector3 . Transform ( new Vector3 ( vertices [ c ] [ i ] . x , vertices [ c ] [ i ] . y , vertices [ c ] [ i ] . z ) , transform ) ;
2016-04-11 23:05:16 +00:00
vertices [ c ] [ i ] . x = transformed . X ;
vertices [ c ] [ i ] . y = transformed . Y ;
vertices [ c ] [ i ] . z = transformed . Z ;
}
Fixed, Draw Lines/Rectangle/Circle/Curve modes: line length labels displayed incorrect length.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: line length labels are now displayed the same way as in Draw modes.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: "lock movement to cardinal directions" mode (Alt-Shift-Drag) now locks movement in 4 directions instead of 8 and doesn't snap map elements to nearest grid intersections when they are not aligned to it.
Added, Visual mode, GZDoom, DECORATE: FORCEXYBILLBOARD flag is now supported.
Added, Visual mode, GLOOME, DECORATE: FLOORSPRITE, CEILSPRITE, WALLSPRITE, ROLLSPRITE and STICKTOPLANE flags are now supported (implementation is somewhat broken ATM and probably doesn't work the same way as in GLOOME, because Windows build with most these features is nowhere to be found...).
Fixed, Visual mode: in some cases Thing brightness was calculated incorrectly.
Updated ZDoom_DECORATE.cfg.
2015-08-25 22:05:14 +00:00
}
2016-04-11 23:05:16 +00:00
break ;
2016-07-11 22:13:43 +00:00
default : throw new NotImplementedException ( "Unknown ThingRenderMode" ) ;
2016-04-11 23:05:16 +00:00
}
Fixed, Draw Lines/Rectangle/Circle/Curve modes: line length labels displayed incorrect length.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: line length labels are now displayed the same way as in Draw modes.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: "lock movement to cardinal directions" mode (Alt-Shift-Drag) now locks movement in 4 directions instead of 8 and doesn't snap map elements to nearest grid intersections when they are not aligned to it.
Added, Visual mode, GZDoom, DECORATE: FORCEXYBILLBOARD flag is now supported.
Added, Visual mode, GLOOME, DECORATE: FLOORSPRITE, CEILSPRITE, WALLSPRITE, ROLLSPRITE and STICKTOPLANE flags are now supported (implementation is somewhat broken ATM and probably doesn't work the same way as in GLOOME, because Windows build with most these features is nowhere to be found...).
Fixed, Visual mode: in some cases Thing brightness was calculated incorrectly.
Updated ZDoom_DECORATE.cfg.
2015-08-25 22:05:14 +00:00
}
2009-04-19 18:07:22 +00:00
}
// This updates the visual thing
public virtual void Update ( )
{
2013-09-11 09:47:53 +00:00
// Do we need to update the geometry buffer?
2015-10-02 14:47:34 +00:00
if ( updategeo )
2009-04-19 18:07:22 +00:00
{
2016-04-11 23:05:16 +00:00
//mxd. Trash geometry buffers
if ( geobuffers ! = null )
foreach ( VertexBuffer geobuffer in geobuffers ) geobuffer . Dispose ( ) ;
2013-09-11 09:47:53 +00:00
// Any vertics?
2015-10-02 14:47:34 +00:00
if ( vertices . Length > 0 )
2014-12-03 23:15:26 +00:00
{
2016-04-11 23:05:16 +00:00
geobuffers = new VertexBuffer [ vertices . Length ] ;
for ( int i = 0 ; i < vertices . Length ; i + + )
{
// Make a new buffer
geobuffers [ i ] = new VertexBuffer ( General . Map . Graphics . Device , WorldVertex . Stride * vertices [ i ] . Length ,
Usage . WriteOnly | Usage . Dynamic , VertexFormat . None , Pool . Default ) ;
// Fill the buffer
DataStream bufferstream = geobuffers [ i ] . Lock ( 0 , WorldVertex . Stride * vertices [ i ] . Length , LockFlags . Discard ) ;
bufferstream . WriteRange ( vertices [ i ] ) ;
geobuffers [ i ] . Unlock ( ) ;
bufferstream . Dispose ( ) ;
}
2013-09-11 09:47:53 +00:00
}
2015-10-02 14:47:34 +00:00
2013-09-11 09:47:53 +00:00
//mxd. Check if thing is light
2014-12-03 23:15:26 +00:00
CheckLightState ( ) ;
2009-04-19 18:07:22 +00:00
// Done
updategeo = false ;
}
Game Configurations: added Vanilla Strife, Vanilla Heretic and Vanilla Hexen game configurations.
Added "makedoorceil" game configuration property. Works the same way as "makedoortrack" and "makedoordoor", but for ceilings of door sectors.
Changed, Game configurations: the editor no longer tries to load DECORATE/MODELDEF/VOXELDEF/GLDEFS/REVERBS lumps when "decorategames" setting is not specified / is set to empty string.
Changed, General interface: "Tools -> Reload MODELDEF/VOXELDEF" and "Tools -> Reload GLDEFS" menu items are no longer shown when current game configuration doesn't support DECORATE.
Fixed a crash when pasting linedef/thing properties in Hexen map format.
Fixed, Visual mode: Visual Thing resources were not fully unloaded when resetting D3D device leading to crash when switching to the editor from a DX-using game engine (like ZDoom) running in fullscreen.
Fixed: in some cases, when current game configuration supported multiple script compilers, it was possible to open/create a map or change map options without selecting any script compiler.
Fixed, New Map Options window: default map name was not updated when switching game configurations.
Fixed: copied map element properties were not reset after switching to another map.
Fixed: stored textures for "Make Door" action were not reset after switching to another map.
Fixed, Game Configurations window: currently selected test engine name was not updated when pasting test engines from another configuration.
Fixed, Game Configurations: all "Heretic in Doom map format" configurations were using Doom sector effects list.
Fixed, Game Configurations: all "Strife in Doom map format" configurations were using Doom sector effects list.
2015-10-21 13:35:42 +00:00
//mxd. Need to update thing cage?
if ( updatecage )
{
// Trash cage buffer
if ( cagebuffer ! = null ) cagebuffer . Dispose ( ) ;
cagebuffer = null ;
// Make a new cage
List < WorldVertex > cageverts ;
if ( sizeless )
{
2015-10-28 12:08:36 +00:00
WorldVertex v0 = new WorldVertex ( - thing . Size + position_v3 . X , - thing . Size + position_v3 . Y , position_v3 . Z ) ;
WorldVertex v1 = new WorldVertex ( thing . Size + position_v3 . X , thing . Size + position_v3 . Y , position_v3 . Z ) ;
WorldVertex v2 = new WorldVertex ( thing . Size + position_v3 . X , - thing . Size + position_v3 . Y , position_v3 . Z ) ;
WorldVertex v3 = new WorldVertex ( - thing . Size + position_v3 . X , thing . Size + position_v3 . Y , position_v3 . Z ) ;
WorldVertex v4 = new WorldVertex ( position_v3 . X , position_v3 . Y , thing . Size + position_v3 . Z ) ;
WorldVertex v5 = new WorldVertex ( position_v3 . X , position_v3 . Y , - thing . Size + position_v3 . Z ) ;
Game Configurations: added Vanilla Strife, Vanilla Heretic and Vanilla Hexen game configurations.
Added "makedoorceil" game configuration property. Works the same way as "makedoortrack" and "makedoordoor", but for ceilings of door sectors.
Changed, Game configurations: the editor no longer tries to load DECORATE/MODELDEF/VOXELDEF/GLDEFS/REVERBS lumps when "decorategames" setting is not specified / is set to empty string.
Changed, General interface: "Tools -> Reload MODELDEF/VOXELDEF" and "Tools -> Reload GLDEFS" menu items are no longer shown when current game configuration doesn't support DECORATE.
Fixed a crash when pasting linedef/thing properties in Hexen map format.
Fixed, Visual mode: Visual Thing resources were not fully unloaded when resetting D3D device leading to crash when switching to the editor from a DX-using game engine (like ZDoom) running in fullscreen.
Fixed: in some cases, when current game configuration supported multiple script compilers, it was possible to open/create a map or change map options without selecting any script compiler.
Fixed, New Map Options window: default map name was not updated when switching game configurations.
Fixed: copied map element properties were not reset after switching to another map.
Fixed: stored textures for "Make Door" action were not reset after switching to another map.
Fixed, Game Configurations window: currently selected test engine name was not updated when pasting test engines from another configuration.
Fixed, Game Configurations: all "Heretic in Doom map format" configurations were using Doom sector effects list.
Fixed, Game Configurations: all "Strife in Doom map format" configurations were using Doom sector effects list.
2015-10-21 13:35:42 +00:00
cageverts = new List < WorldVertex > ( new [ ] { v0 , v1 , v2 , v3 , v4 , v5 } ) ;
}
else
{
2015-10-28 12:08:36 +00:00
float top = position_v3 . Z + thing . Height ;
Game Configurations: added Vanilla Strife, Vanilla Heretic and Vanilla Hexen game configurations.
Added "makedoorceil" game configuration property. Works the same way as "makedoortrack" and "makedoordoor", but for ceilings of door sectors.
Changed, Game configurations: the editor no longer tries to load DECORATE/MODELDEF/VOXELDEF/GLDEFS/REVERBS lumps when "decorategames" setting is not specified / is set to empty string.
Changed, General interface: "Tools -> Reload MODELDEF/VOXELDEF" and "Tools -> Reload GLDEFS" menu items are no longer shown when current game configuration doesn't support DECORATE.
Fixed a crash when pasting linedef/thing properties in Hexen map format.
Fixed, Visual mode: Visual Thing resources were not fully unloaded when resetting D3D device leading to crash when switching to the editor from a DX-using game engine (like ZDoom) running in fullscreen.
Fixed: in some cases, when current game configuration supported multiple script compilers, it was possible to open/create a map or change map options without selecting any script compiler.
Fixed, New Map Options window: default map name was not updated when switching game configurations.
Fixed: copied map element properties were not reset after switching to another map.
Fixed: stored textures for "Make Door" action were not reset after switching to another map.
Fixed, Game Configurations window: currently selected test engine name was not updated when pasting test engines from another configuration.
Fixed, Game Configurations: all "Heretic in Doom map format" configurations were using Doom sector effects list.
Fixed, Game Configurations: all "Strife in Doom map format" configurations were using Doom sector effects list.
2015-10-21 13:35:42 +00:00
float bottom = position_v3 . Z ;
2015-10-28 12:08:36 +00:00
WorldVertex v0 = new WorldVertex ( - thing . Size + position_v3 . X , - thing . Size + position_v3 . Y , bottom ) ;
WorldVertex v1 = new WorldVertex ( - thing . Size + position_v3 . X , thing . Size + position_v3 . Y , bottom ) ;
WorldVertex v2 = new WorldVertex ( thing . Size + position_v3 . X , thing . Size + position_v3 . Y , bottom ) ;
WorldVertex v3 = new WorldVertex ( thing . Size + position_v3 . X , - thing . Size + position_v3 . Y , bottom ) ;
Game Configurations: added Vanilla Strife, Vanilla Heretic and Vanilla Hexen game configurations.
Added "makedoorceil" game configuration property. Works the same way as "makedoortrack" and "makedoordoor", but for ceilings of door sectors.
Changed, Game configurations: the editor no longer tries to load DECORATE/MODELDEF/VOXELDEF/GLDEFS/REVERBS lumps when "decorategames" setting is not specified / is set to empty string.
Changed, General interface: "Tools -> Reload MODELDEF/VOXELDEF" and "Tools -> Reload GLDEFS" menu items are no longer shown when current game configuration doesn't support DECORATE.
Fixed a crash when pasting linedef/thing properties in Hexen map format.
Fixed, Visual mode: Visual Thing resources were not fully unloaded when resetting D3D device leading to crash when switching to the editor from a DX-using game engine (like ZDoom) running in fullscreen.
Fixed: in some cases, when current game configuration supported multiple script compilers, it was possible to open/create a map or change map options without selecting any script compiler.
Fixed, New Map Options window: default map name was not updated when switching game configurations.
Fixed: copied map element properties were not reset after switching to another map.
Fixed: stored textures for "Make Door" action were not reset after switching to another map.
Fixed, Game Configurations window: currently selected test engine name was not updated when pasting test engines from another configuration.
Fixed, Game Configurations: all "Heretic in Doom map format" configurations were using Doom sector effects list.
Fixed, Game Configurations: all "Strife in Doom map format" configurations were using Doom sector effects list.
2015-10-21 13:35:42 +00:00
2015-10-28 12:08:36 +00:00
WorldVertex v4 = new WorldVertex ( - thing . Size + position_v3 . X , - thing . Size + position_v3 . Y , top ) ;
WorldVertex v5 = new WorldVertex ( - thing . Size + position_v3 . X , thing . Size + position_v3 . Y , top ) ;
WorldVertex v6 = new WorldVertex ( thing . Size + position_v3 . X , thing . Size + position_v3 . Y , top ) ;
WorldVertex v7 = new WorldVertex ( thing . Size + position_v3 . X , - thing . Size + position_v3 . Y , top ) ;
Game Configurations: added Vanilla Strife, Vanilla Heretic and Vanilla Hexen game configurations.
Added "makedoorceil" game configuration property. Works the same way as "makedoortrack" and "makedoordoor", but for ceilings of door sectors.
Changed, Game configurations: the editor no longer tries to load DECORATE/MODELDEF/VOXELDEF/GLDEFS/REVERBS lumps when "decorategames" setting is not specified / is set to empty string.
Changed, General interface: "Tools -> Reload MODELDEF/VOXELDEF" and "Tools -> Reload GLDEFS" menu items are no longer shown when current game configuration doesn't support DECORATE.
Fixed a crash when pasting linedef/thing properties in Hexen map format.
Fixed, Visual mode: Visual Thing resources were not fully unloaded when resetting D3D device leading to crash when switching to the editor from a DX-using game engine (like ZDoom) running in fullscreen.
Fixed: in some cases, when current game configuration supported multiple script compilers, it was possible to open/create a map or change map options without selecting any script compiler.
Fixed, New Map Options window: default map name was not updated when switching game configurations.
Fixed: copied map element properties were not reset after switching to another map.
Fixed: stored textures for "Make Door" action were not reset after switching to another map.
Fixed, Game Configurations window: currently selected test engine name was not updated when pasting test engines from another configuration.
Fixed, Game Configurations: all "Heretic in Doom map format" configurations were using Doom sector effects list.
Fixed, Game Configurations: all "Strife in Doom map format" configurations were using Doom sector effects list.
2015-10-21 13:35:42 +00:00
cageverts = new List < WorldVertex > ( new [ ] { v0 , v1 ,
v1 , v2 ,
v2 , v3 ,
v3 , v0 ,
v4 , v5 ,
v5 , v6 ,
v6 , v7 ,
v7 , v4 ,
v0 , v4 ,
v1 , v5 ,
v2 , v6 ,
v3 , v7 } ) ;
}
// Make new arrow
if ( Thing . IsDirectional )
{
2015-10-28 12:08:36 +00:00
Matrix transform = Matrix . Scaling ( thing . Size , thing . Size , thing . Size )
2016-07-13 21:53:48 +00:00
* ( Matrix . RotationY ( - Thing . RollRad ) * Matrix . RotationX ( - Thing . PitchRad ) * Matrix . RotationZ ( Thing . Angle ) )
Game Configurations: added Vanilla Strife, Vanilla Heretic and Vanilla Hexen game configurations.
Added "makedoorceil" game configuration property. Works the same way as "makedoortrack" and "makedoordoor", but for ceilings of door sectors.
Changed, Game configurations: the editor no longer tries to load DECORATE/MODELDEF/VOXELDEF/GLDEFS/REVERBS lumps when "decorategames" setting is not specified / is set to empty string.
Changed, General interface: "Tools -> Reload MODELDEF/VOXELDEF" and "Tools -> Reload GLDEFS" menu items are no longer shown when current game configuration doesn't support DECORATE.
Fixed a crash when pasting linedef/thing properties in Hexen map format.
Fixed, Visual mode: Visual Thing resources were not fully unloaded when resetting D3D device leading to crash when switching to the editor from a DX-using game engine (like ZDoom) running in fullscreen.
Fixed: in some cases, when current game configuration supported multiple script compilers, it was possible to open/create a map or change map options without selecting any script compiler.
Fixed, New Map Options window: default map name was not updated when switching game configurations.
Fixed: copied map element properties were not reset after switching to another map.
Fixed: stored textures for "Make Door" action were not reset after switching to another map.
Fixed, Game Configurations window: currently selected test engine name was not updated when pasting test engines from another configuration.
Fixed, Game Configurations: all "Heretic in Doom map format" configurations were using Doom sector effects list.
Fixed, Game Configurations: all "Strife in Doom map format" configurations were using Doom sector effects list.
2015-10-21 13:35:42 +00:00
* ( sizeless ? position : position * Matrix . Translation ( 0.0f , 0.0f , thingheight / 2f ) ) ;
WorldVertex a0 = new WorldVertex ( Vector3D . Transform ( 0.0f , 0.0f , 0.0f , transform ) ) ; //start
WorldVertex a1 = new WorldVertex ( Vector3D . Transform ( 0.0f , - 1.5f , 0.0f , transform ) ) ; //end
WorldVertex a2 = new WorldVertex ( Vector3D . Transform ( 0.2f , - 1.1f , 0.2f , transform ) ) ;
WorldVertex a3 = new WorldVertex ( Vector3D . Transform ( - 0.2f , - 1.1f , 0.2f , transform ) ) ;
WorldVertex a4 = new WorldVertex ( Vector3D . Transform ( 0.2f , - 1.1f , - 0.2f , transform ) ) ;
WorldVertex a5 = new WorldVertex ( Vector3D . Transform ( - 0.2f , - 1.1f , - 0.2f , transform ) ) ;
cageverts . AddRange ( new [ ] { a0 , a1 ,
a1 , a2 ,
a1 , a3 ,
a1 , a4 ,
a1 , a5 } ) ;
}
// Create buffer
WorldVertex [ ] cv = cageverts . ToArray ( ) ;
cagelength = cv . Length / 2 ;
cagebuffer = new VertexBuffer ( General . Map . Graphics . Device , WorldVertex . Stride * cv . Length , Usage . WriteOnly | Usage . Dynamic , VertexFormat . None , Pool . Default ) ;
cagebuffer . Lock ( 0 , WorldVertex . Stride * cv . Length , LockFlags . None ) . WriteRange ( cv ) ;
cagebuffer . Unlock ( ) ;
// Done
updatecage = false ;
}
2009-04-19 18:07:22 +00:00
}
2012-04-17 19:13:47 +00:00
2013-09-11 09:47:53 +00:00
//mxd
2014-12-03 23:15:26 +00:00
protected void CheckLightState ( )
{
2013-09-11 09:47:53 +00:00
//mxd. Check if thing is light
int light_id = Array . IndexOf ( GZBuilder . GZGeneral . GZ_LIGHTS , thing . Type ) ;
2015-10-28 12:08:36 +00:00
if ( light_id ! = - 1 )
2014-12-03 23:15:26 +00:00
{
2013-09-11 09:47:53 +00:00
isGldefsLight = false ;
lightInterval = - 1 ;
2014-12-03 23:15:26 +00:00
UpdateLight ( light_id ) ;
UpdateBoundingBox ( lightRadius , lightRadius * 2 ) ;
}
//check if we have light from GLDEFS
2015-10-28 12:08:36 +00:00
else if ( General . Map . Data . GldefsEntries . ContainsKey ( thing . Type ) )
2014-12-03 23:15:26 +00:00
{
2013-09-11 09:47:53 +00:00
isGldefsLight = true ;
2014-12-03 23:15:26 +00:00
UpdateGldefsLight ( ) ;
UpdateBoundingBox ( lightRadius , lightRadius * 2 ) ;
}
else
{
Fixed, Draw Lines/Rectangle/Circle/Curve modes: line length labels displayed incorrect length.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: line length labels are now displayed the same way as in Draw modes.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: "lock movement to cardinal directions" mode (Alt-Shift-Drag) now locks movement in 4 directions instead of 8 and doesn't snap map elements to nearest grid intersections when they are not aligned to it.
Added, Visual mode, GZDoom, DECORATE: FORCEXYBILLBOARD flag is now supported.
Added, Visual mode, GLOOME, DECORATE: FLOORSPRITE, CEILSPRITE, WALLSPRITE, ROLLSPRITE and STICKTOPLANE flags are now supported (implementation is somewhat broken ATM and probably doesn't work the same way as in GLOOME, because Windows build with most these features is nowhere to be found...).
Fixed, Visual mode: in some cases Thing brightness was calculated incorrectly.
Updated ZDoom_DECORATE.cfg.
2015-08-25 22:05:14 +00:00
UpdateBoundingBox ( ( int ) thing . Size , thingheight ) ;
2014-12-03 23:15:26 +00:00
2013-09-11 09:47:53 +00:00
lightType = DynamicLightType . NONE ;
lightRadius = - 1 ;
lightPrimaryRadius = - 1 ;
lightSecondaryRadius = - 1 ;
lightRenderStyle = DynamicLightRenderStyle . NONE ;
lightInterval = - 1 ;
isGldefsLight = false ;
}
}
2015-09-27 21:09:14 +00:00
//mxd. Used in ColorPicker to update light
2014-12-03 23:15:26 +00:00
public void UpdateLight ( )
{
2013-09-11 09:47:53 +00:00
int light_id = Array . IndexOf ( GZBuilder . GZGeneral . GZ_LIGHTS , thing . Type ) ;
2015-10-28 12:08:36 +00:00
if ( light_id ! = - 1 )
2014-12-03 23:15:26 +00:00
{
UpdateLight ( light_id ) ;
UpdateBoundingBox ( lightRadius , lightRadius * 2 ) ;
2013-09-11 09:47:53 +00:00
}
}
2015-09-27 21:09:14 +00:00
//mxd. Update light info
2014-12-03 23:15:26 +00:00
private void UpdateLight ( int lightId )
{
2015-10-28 12:08:36 +00:00
if ( lightId < GZBuilder . GZGeneral . GZ_LIGHT_TYPES [ 2 ] ) //if it's gzdoom light
2014-12-03 23:15:26 +00:00
{
2013-09-11 09:47:53 +00:00
int n ;
2015-10-28 12:08:36 +00:00
if ( lightId < GZBuilder . GZGeneral . GZ_LIGHT_TYPES [ 0 ] )
2014-12-03 23:15:26 +00:00
{
2013-09-11 09:47:53 +00:00
n = 0 ;
lightRenderStyle = DynamicLightRenderStyle . NORMAL ;
//lightColor.Alpha used in shader to perform some calculations based on light type
2016-09-07 15:15:07 +00:00
lightColor = new Color4 ( ( float ) lightRenderStyle / 100.0f ,
thing . Args [ 0 ] / DYNLIGHT_INTENSITY_SCALER ,
thing . Args [ 1 ] / DYNLIGHT_INTENSITY_SCALER ,
thing . Args [ 2 ] / DYNLIGHT_INTENSITY_SCALER ) ;
2014-12-03 23:15:26 +00:00
}
2015-10-28 12:08:36 +00:00
else if ( lightId < GZBuilder . GZGeneral . GZ_LIGHT_TYPES [ 1 ] )
2014-12-03 23:15:26 +00:00
{
2013-09-11 09:47:53 +00:00
n = 10 ;
lightRenderStyle = DynamicLightRenderStyle . ADDITIVE ;
2016-09-07 15:15:07 +00:00
lightColor = new Color4 ( ( float ) lightRenderStyle / 100.0f ,
thing . Args [ 0 ] / DYNLIGHT_INTENSITY_SCALER ,
thing . Args [ 1 ] / DYNLIGHT_INTENSITY_SCALER ,
thing . Args [ 2 ] / DYNLIGHT_INTENSITY_SCALER ) ;
2014-12-03 23:15:26 +00:00
}
else
{
2013-09-11 09:47:53 +00:00
n = 20 ;
lightRenderStyle = DynamicLightRenderStyle . NEGATIVE ;
2016-09-07 15:15:07 +00:00
lightColor = new Color4 ( ( float ) lightRenderStyle / 100.0f ,
thing . Args [ 0 ] / SUBLIGHT_INTENSITY_SCALER ,
thing . Args [ 1 ] / SUBLIGHT_INTENSITY_SCALER ,
thing . Args [ 2 ] / SUBLIGHT_INTENSITY_SCALER ) ;
2013-09-11 09:47:53 +00:00
}
lightType = ( DynamicLightType ) ( thing . Type - 9800 - n ) ;
2015-10-28 12:08:36 +00:00
if ( lightType = = DynamicLightType . SECTOR )
2014-12-03 23:15:26 +00:00
{
2013-09-11 09:47:53 +00:00
int scaler = 1 ;
2015-10-28 12:08:36 +00:00
if ( thing . Sector ! = null ) scaler = thing . Sector . Brightness / 4 ;
2016-09-07 15:15:07 +00:00
lightPrimaryRadius = ( thing . Args [ 3 ] * scaler ) ;
2014-12-03 23:15:26 +00:00
}
else
{
2016-09-07 15:15:07 +00:00
lightPrimaryRadius = ( thing . Args [ 3 ] * 2 ) ; //works... that.. way in GZDoom
if ( lightType > 0 ) lightSecondaryRadius = ( thing . Args [ 4 ] * 2 ) ;
2013-09-11 09:47:53 +00:00
}
2015-09-27 21:09:14 +00:00
}
else //it's one of vavoom lights
2014-12-03 23:15:26 +00:00
{
2013-09-11 09:47:53 +00:00
lightRenderStyle = DynamicLightRenderStyle . VAVOOM ;
2013-07-29 08:50:50 +00:00
lightType = ( DynamicLightType ) thing . Type ;
2015-10-28 12:08:36 +00:00
if ( lightType = = DynamicLightType . VAVOOM_COLORED )
2016-09-07 15:15:07 +00:00
{
lightColor = new Color4 ( ( float ) lightRenderStyle / 100.0f ,
thing . Args [ 1 ] / DYNLIGHT_INTENSITY_SCALER ,
thing . Args [ 2 ] / DYNLIGHT_INTENSITY_SCALER ,
thing . Args [ 3 ] / DYNLIGHT_INTENSITY_SCALER ) ;
}
2013-09-11 09:47:53 +00:00
else
2016-09-07 15:15:07 +00:00
{
lightColor = new Color4 ( ( float ) lightRenderStyle / 100.0f , 0.5f , 0.5f , 0.5f ) ;
}
lightPrimaryRadius = ( thing . Args [ 0 ] * 8 ) ;
2013-09-11 09:47:53 +00:00
}
2015-09-27 21:09:14 +00:00
2013-09-11 09:47:53 +00:00
UpdateLightRadius ( ) ;
}
//mxd
2014-12-03 23:15:26 +00:00
private void UpdateGldefsLight ( )
{
2013-09-11 09:47:53 +00:00
DynamicLightData light = General . Map . Data . GldefsEntries [ thing . Type ] ;
//apply settings
lightRenderStyle = light . Subtractive ? DynamicLightRenderStyle . NEGATIVE : DynamicLightRenderStyle . NORMAL ;
2016-09-07 15:15:07 +00:00
lightColor = new Color4 ( ( float ) lightRenderStyle / 100.0f , light . Color . Red , light . Color . Green , light . Color . Blue ) ;
2015-08-28 19:22:28 +00:00
Vector2D o = new Vector2D ( light . Offset . X , light . Offset . Y ) . GetRotated ( thing . Angle - Angle2D . PIHALF ) ;
lightOffset = new Vector3 ( o . x , o . y , light . Offset . Z ) ;
2013-09-11 09:47:53 +00:00
lightType = light . Type ;
2015-10-28 12:08:36 +00:00
if ( lightType = = DynamicLightType . SECTOR )
2014-12-03 23:15:26 +00:00
{
2015-08-28 19:22:28 +00:00
lightPrimaryRadius = light . Interval * thing . Sector . Brightness / 5.0f ;
2014-12-03 23:15:26 +00:00
}
else
{
2016-09-07 15:15:07 +00:00
lightPrimaryRadius = light . PrimaryRadius ;
lightSecondaryRadius = light . SecondaryRadius ;
2013-09-11 09:47:53 +00:00
}
lightInterval = light . Interval ;
2014-12-03 23:15:26 +00:00
UpdateLightRadius ( lightInterval ) ;
2013-09-11 09:47:53 +00:00
}
//mxd
2014-12-03 23:15:26 +00:00
public void UpdateLightRadius ( )
{
UpdateLightRadius ( ( lightInterval ! = - 1 ? lightInterval : thing . AngleDoom ) ) ;
2013-09-11 09:47:53 +00:00
}
//mxd
2014-12-03 23:15:26 +00:00
private void UpdateLightRadius ( int interval )
{
2015-10-28 12:08:36 +00:00
if ( lightType = = DynamicLightType . NONE )
2014-12-03 23:15:26 +00:00
{
2013-09-11 09:47:53 +00:00
General . ErrorLogger . Add ( ErrorType . Error , "Please check that thing is light before accessing it's PositionAndRadius! You can use lightType, which is -1 if thing isn't light" ) ;
return ;
}
2015-10-28 12:08:36 +00:00
if ( General . Settings . GZDrawLightsMode = = LightRenderMode . ALL | | Array . IndexOf ( GZBuilder . GZGeneral . GZ_ANIMATED_LIGHT_TYPES , lightType ) = = - 1 )
2014-12-03 23:15:26 +00:00
{
2013-09-11 09:47:53 +00:00
lightRadius = lightPrimaryRadius ;
return ;
}
2014-12-03 23:15:26 +00:00
if ( interval = = 0 )
{
2014-03-11 09:44:39 +00:00
lightRadius = 0 ;
return ;
}
2013-09-11 09:47:53 +00:00
float rMin = Math . Min ( lightPrimaryRadius , lightSecondaryRadius ) ;
float rMax = Math . Max ( lightPrimaryRadius , lightSecondaryRadius ) ;
float diff = rMax - rMin ;
2015-10-28 12:08:36 +00:00
switch ( lightType )
2014-12-03 23:15:26 +00:00
{
2014-03-10 14:35:38 +00:00
case DynamicLightType . PULSE :
2016-08-29 10:06:16 +00:00
lightDelta = ( ( float ) Math . Sin ( Clock . CurrentTime / ( interval * 4.0f ) ) + 1.0f ) / 2.0f ; //just playing by the eye here... in [0.0 ... 1.0] interval
2014-03-10 14:35:38 +00:00
lightRadius = rMin + diff * lightDelta ;
break ;
2016-08-29 10:06:16 +00:00
case DynamicLightType . FLICKER :
float fdelta = ( float ) Math . Sin ( Clock . CurrentTime / 0.1f ) ; //just playing by the eye here...
2015-10-28 12:08:36 +00:00
if ( Math . Sign ( fdelta ) ! = Math . Sign ( lightDelta ) )
2014-12-03 23:15:26 +00:00
{
2014-03-10 14:35:38 +00:00
lightDelta = fdelta ;
lightRadius = ( General . Random ( 0 , 359 ) < interval ? rMax : rMin ) ;
}
break ;
case DynamicLightType . RANDOM :
2016-08-29 10:06:16 +00:00
float rdelta = ( float ) Math . Sin ( Clock . CurrentTime / ( interval * 9.0f ) ) ; //just playing by the eye here...
2015-10-28 12:08:36 +00:00
if ( Math . Sign ( rdelta ) ! = Math . Sign ( lightDelta ) )
2014-12-03 23:15:26 +00:00
{
2014-03-10 14:35:38 +00:00
lightRadius = rMin + ( General . Random ( 0 , ( int ) ( diff * 10 ) ) ) / 10.0f ;
}
lightDelta = rdelta ;
break ;
2013-09-11 09:47:53 +00:00
}
}
//mxd. update bounding box
2014-12-03 23:15:26 +00:00
public void UpdateBoundingBox ( )
{
2015-06-22 19:52:23 +00:00
if ( lightType ! = DynamicLightType . NONE & & lightRadius > thing . Size )
2014-12-03 23:15:26 +00:00
UpdateBoundingBox ( lightRadius , lightRadius * 2 ) ;
2013-09-11 09:47:53 +00:00
}
2014-12-03 23:15:26 +00:00
private void UpdateBoundingBox ( float width , float height )
{
2015-09-27 21:09:14 +00:00
boundingBox = new Vector3D [ 9 ] ;
boundingBox [ 0 ] = CenterV3D ;
2013-09-11 09:47:53 +00:00
float h2 = height / 2.0f ;
2015-09-27 21:09:14 +00:00
boundingBox [ 1 ] = new Vector3D ( position_v3 . X - width , position_v3 . Y - width , Center . Z - h2 ) ;
boundingBox [ 2 ] = new Vector3D ( position_v3 . X + width , position_v3 . Y - width , Center . Z - h2 ) ;
boundingBox [ 3 ] = new Vector3D ( position_v3 . X - width , position_v3 . Y + width , Center . Z - h2 ) ;
boundingBox [ 4 ] = new Vector3D ( position_v3 . X + width , position_v3 . Y + width , Center . Z - h2 ) ;
2013-09-11 09:47:53 +00:00
2015-09-27 21:09:14 +00:00
boundingBox [ 5 ] = new Vector3D ( position_v3 . X - width , position_v3 . Y - width , Center . Z + h2 ) ;
boundingBox [ 6 ] = new Vector3D ( position_v3 . X + width , position_v3 . Y - width , Center . Z + h2 ) ;
boundingBox [ 7 ] = new Vector3D ( position_v3 . X - width , position_v3 . Y + width , Center . Z + h2 ) ;
boundingBox [ 8 ] = new Vector3D ( position_v3 . X + width , position_v3 . Y + width , Center . Z + h2 ) ;
2013-09-11 09:47:53 +00:00
}
2016-04-11 23:05:16 +00:00
//mxd. This updates the sprite frame to be rendered
internal void UpdateSpriteFrame ( )
{
if ( textures . Length ! = 8 )
spriteframe = 0 ;
else
spriteframe = ( General . ClampAngle ( ( int ) Angle2D . RadToDeg ( ( General . Map . VisualCamera . Position - thing . Position ) . GetAngleXY ( ) ) - thing . AngleDoom + 292 ) ) / 45 ; // Convert to [0..7] range; 292 == 270 + 45/2
}
2009-04-19 18:07:22 +00:00
/// <summary>
/// This is called when the thing must be tested for line intersection. This should reject
/// as fast as possible to rule out all geometry that certainly does not touch the line.
/// </summary>
public virtual bool PickFastReject ( Vector3D from , Vector3D to , Vector3D dir )
{
return false ;
}
/// <summary>
/// This is called when the thing must be tested for line intersection. This should perform
/// accurate hit detection and set u_ray to the position on the ray where this hits the geometry.
/// </summary>
public virtual bool PickAccurate ( Vector3D from , Vector3D to , Vector3D dir , ref float u_ray )
{
return false ;
}
#endregion
}
}