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 ;
2015-03-03 09:42:54 +00:00
using System.Globalization ;
2009-04-19 18:07:22 +00:00
using System.Windows.Forms ;
using CodeImp.DoomBuilder.Map ;
using CodeImp.DoomBuilder.Rendering ;
using CodeImp.DoomBuilder.Geometry ;
using CodeImp.DoomBuilder.VisualModes ;
using CodeImp.DoomBuilder.Data ;
#endregion
namespace CodeImp.DoomBuilder.BuilderModes
{
internal class BaseVisualThing : VisualThing , IVisualEventReceiver
{
#region = = = = = = = = = = = = = = = = = = Constants
#endregion
#region = = = = = = = = = = = = = = = = = = Variables
2014-12-22 21:36:49 +00:00
private readonly BaseVisualMode mode ;
2009-04-19 18:07:22 +00:00
private bool isloaded ;
2015-03-26 21:31:46 +00:00
private bool nointeraction ; //mxd
2016-04-11 23:05:16 +00:00
private ImageData [ ] sprites ;
2009-04-19 18:07:22 +00:00
private float cageradius2 ;
private Vector2D pos2d ;
private Vector3D boxp1 ;
private Vector3D boxp2 ;
2013-07-19 15:30:58 +00:00
private static List < BaseVisualThing > updateList ; //mxd
2009-04-19 18:07:22 +00:00
// Undo/redo
private int undoticket ;
2009-05-01 20:31:17 +00:00
// If this is set to true, the thing will be rebuilt after the action is performed.
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 bool changed ;
2009-05-01 20:31:17 +00:00
2009-04-19 18:07:22 +00:00
#endregion
#region = = = = = = = = = = = = = = = = = = Properties
2009-05-01 20:31:17 +00:00
public bool Changed { get { return changed ; } set { changed | = value ; } }
2014-12-22 21:36:49 +00:00
2009-04-19 18:07:22 +00:00
#endregion
#region = = = = = = = = = = = = = = = = = = Constructor / Setup
// Constructor
public BaseVisualThing ( BaseVisualMode mode , Thing t ) : base ( t )
{
this . mode = mode ;
2011-12-02 23:11:16 +00:00
// Find thing information
info = General . Map . Data . GetThingInfo ( Thing . Type ) ;
2015-03-26 21:31:46 +00:00
//mxd. When true, the thing can be moved below floor/above ceiling
nointeraction = ( info . Actor ! = null & & info . Actor . GetFlagValue ( "nointeraction" , false ) ) ;
2016-04-11 23:05:16 +00:00
//mxd. Find sprite textures
sprites = new ImageData [ info . SpriteFrame . Length ] ;
for ( int i = 0 ; i < info . SpriteFrame . Length ; i + + )
2011-12-02 23:11:16 +00:00
{
2016-04-11 23:05:16 +00:00
sprites [ i ] = General . Map . Data . GetSpriteImage ( info . SpriteFrame [ i ] . Sprite ) ;
if ( sprites [ i ] ! = null ) sprites [ i ] . AddReference ( ) ;
2011-12-02 23:11:16 +00:00
}
2013-03-18 13:52:27 +00:00
//mxd
2014-12-03 23:15:26 +00:00
if ( mode . UseSelectionFromClassicMode & & t . Selected )
{
2013-03-18 13:52:27 +00:00
this . selected = true ;
mode . AddSelectedObject ( this ) ;
}
2009-04-19 18:07:22 +00:00
// We have no destructor
GC . SuppressFinalize ( this ) ;
}
// This builds the thing geometry. Returns false when nothing was created.
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 bool Setup ( )
2009-04-19 18:07:22 +00:00
{
2015-11-09 12:20:08 +00:00
// Find the sector in which the thing resides
Thing . DetermineSector ( mode . BlockMap ) ;
//mxd. If the thing is inside a sector, apply DECORATE/UDMF alpha/renderstyle overrides
byte alpha = 255 ;
if ( Thing . Sector ! = null )
Added, Visual mode, DECORATE: "Alpha" and "DefaultAlpha" properties are now supported.
Added, Visual mode, DECORATE: "RenderStyle" property is now partially supported.
Added, Visual mode, DECORATE: +BRIGHT flag is now supported.
Added, Visual mode, UDMF: "Alpha" thing property is now supported.
Added, Visual mode, UDMF: "RenderStyle" thing property is now partially supported.
Added, Visual mode, Hexen map format and UDMF: "Translucent" and "Invisible" thing flags are now supported.
Added, Game Configurations: added "alpha" and "renderstyle" Thing and Thing Category properties.
Fixed, Visual mode: blockmap was not updated when moving things using "Move Thing Left/Right/Forward/Backward" and "Move Thing to Cursor Location" actions.
DECORATE parser: added a warning when unable to find actor's parent class.
Internal: current map format can now be checked using "General.Map.UDMF", "General.Map.HEXEN" and "General.Map.DOOM" properties.
Updated documentation ("Game Configuration - Things Settings" page).
2015-09-28 14:57:48 +00:00
{
2015-11-09 12:20:08 +00:00
string renderstyle = info . RenderStyle ;
alpha = info . AlphaByte ;
if ( General . Map . UDMF )
Added, Visual mode, DECORATE: "Alpha" and "DefaultAlpha" properties are now supported.
Added, Visual mode, DECORATE: "RenderStyle" property is now partially supported.
Added, Visual mode, DECORATE: +BRIGHT flag is now supported.
Added, Visual mode, UDMF: "Alpha" thing property is now supported.
Added, Visual mode, UDMF: "RenderStyle" thing property is now partially supported.
Added, Visual mode, Hexen map format and UDMF: "Translucent" and "Invisible" thing flags are now supported.
Added, Game Configurations: added "alpha" and "renderstyle" Thing and Thing Category properties.
Fixed, Visual mode: blockmap was not updated when moving things using "Move Thing Left/Right/Forward/Backward" and "Move Thing to Cursor Location" actions.
DECORATE parser: added a warning when unable to find actor's parent class.
Internal: current map format can now be checked using "General.Map.UDMF", "General.Map.HEXEN" and "General.Map.DOOM" properties.
Updated documentation ("Game Configuration - Things Settings" page).
2015-09-28 14:57:48 +00:00
{
2015-11-09 12:20:08 +00:00
if ( Thing . IsFlagSet ( "translucent" ) )
{
renderstyle = "translucent" ;
alpha = 64 ;
}
else if ( Thing . IsFlagSet ( "invisible" ) )
{
renderstyle = "none" ;
alpha = 0 ;
}
else if ( Thing . Fields . ContainsKey ( "renderstyle" ) )
{
renderstyle = Thing . Fields . GetValue ( "renderstyle" , renderstyle ) ;
2015-11-24 10:46:49 +00:00
}
if ( ( renderstyle = = "add" | | renderstyle = = "translucent" | | renderstyle = = "subtract" | | renderstyle = = "stencil" )
& & Thing . Fields . ContainsKey ( "alpha" ) )
{
alpha = ( byte ) ( General . Clamp ( Thing . Fields . GetValue ( "alpha" , info . Alpha ) , 0f , 1f ) * 255 ) ;
2015-11-09 12:20:08 +00:00
}
Added, Visual mode, DECORATE: "Alpha" and "DefaultAlpha" properties are now supported.
Added, Visual mode, DECORATE: "RenderStyle" property is now partially supported.
Added, Visual mode, DECORATE: +BRIGHT flag is now supported.
Added, Visual mode, UDMF: "Alpha" thing property is now supported.
Added, Visual mode, UDMF: "RenderStyle" thing property is now partially supported.
Added, Visual mode, Hexen map format and UDMF: "Translucent" and "Invisible" thing flags are now supported.
Added, Game Configurations: added "alpha" and "renderstyle" Thing and Thing Category properties.
Fixed, Visual mode: blockmap was not updated when moving things using "Move Thing Left/Right/Forward/Backward" and "Move Thing to Cursor Location" actions.
DECORATE parser: added a warning when unable to find actor's parent class.
Internal: current map format can now be checked using "General.Map.UDMF", "General.Map.HEXEN" and "General.Map.DOOM" properties.
Updated documentation ("Game Configuration - Things Settings" page).
2015-09-28 14:57:48 +00:00
}
2015-11-09 12:20:08 +00:00
else if ( General . Map . HEXEN )
Added, Visual mode, DECORATE: "Alpha" and "DefaultAlpha" properties are now supported.
Added, Visual mode, DECORATE: "RenderStyle" property is now partially supported.
Added, Visual mode, DECORATE: +BRIGHT flag is now supported.
Added, Visual mode, UDMF: "Alpha" thing property is now supported.
Added, Visual mode, UDMF: "RenderStyle" thing property is now partially supported.
Added, Visual mode, Hexen map format and UDMF: "Translucent" and "Invisible" thing flags are now supported.
Added, Game Configurations: added "alpha" and "renderstyle" Thing and Thing Category properties.
Fixed, Visual mode: blockmap was not updated when moving things using "Move Thing Left/Right/Forward/Backward" and "Move Thing to Cursor Location" actions.
DECORATE parser: added a warning when unable to find actor's parent class.
Internal: current map format can now be checked using "General.Map.UDMF", "General.Map.HEXEN" and "General.Map.DOOM" properties.
Updated documentation ("Game Configuration - Things Settings" page).
2015-09-28 14:57:48 +00:00
{
2015-11-09 12:20:08 +00:00
if ( Thing . IsFlagSet ( "2048" ) )
{
renderstyle = "translucent" ;
alpha = 64 ;
}
else if ( Thing . IsFlagSet ( "4096" ) )
{
renderstyle = "none" ;
alpha = 0 ;
}
Added, Visual mode, DECORATE: "Alpha" and "DefaultAlpha" properties are now supported.
Added, Visual mode, DECORATE: "RenderStyle" property is now partially supported.
Added, Visual mode, DECORATE: +BRIGHT flag is now supported.
Added, Visual mode, UDMF: "Alpha" thing property is now supported.
Added, Visual mode, UDMF: "RenderStyle" thing property is now partially supported.
Added, Visual mode, Hexen map format and UDMF: "Translucent" and "Invisible" thing flags are now supported.
Added, Game Configurations: added "alpha" and "renderstyle" Thing and Thing Category properties.
Fixed, Visual mode: blockmap was not updated when moving things using "Move Thing Left/Right/Forward/Backward" and "Move Thing to Cursor Location" actions.
DECORATE parser: added a warning when unable to find actor's parent class.
Internal: current map format can now be checked using "General.Map.UDMF", "General.Map.HEXEN" and "General.Map.DOOM" properties.
Updated documentation ("Game Configuration - Things Settings" page).
2015-09-28 14:57:48 +00:00
}
2015-11-09 12:20:08 +00:00
// Set appropriate RenderPass
switch ( renderstyle )
Added, Visual mode, DECORATE: "Alpha" and "DefaultAlpha" properties are now supported.
Added, Visual mode, DECORATE: "RenderStyle" property is now partially supported.
Added, Visual mode, DECORATE: +BRIGHT flag is now supported.
Added, Visual mode, UDMF: "Alpha" thing property is now supported.
Added, Visual mode, UDMF: "RenderStyle" thing property is now partially supported.
Added, Visual mode, Hexen map format and UDMF: "Translucent" and "Invisible" thing flags are now supported.
Added, Game Configurations: added "alpha" and "renderstyle" Thing and Thing Category properties.
Fixed, Visual mode: blockmap was not updated when moving things using "Move Thing Left/Right/Forward/Backward" and "Move Thing to Cursor Location" actions.
DECORATE parser: added a warning when unable to find actor's parent class.
Internal: current map format can now be checked using "General.Map.UDMF", "General.Map.HEXEN" and "General.Map.DOOM" properties.
Updated documentation ("Game Configuration - Things Settings" page).
2015-09-28 14:57:48 +00:00
{
2015-11-09 12:20:08 +00:00
case "translucent" :
case "subtract" :
case "stencil" :
RenderPass = RenderPass . Alpha ;
break ;
case "add" :
RenderPass = RenderPass . Additive ;
break ;
case "none" :
RenderPass = RenderPass . Mask ;
alpha = 0 ;
break ;
// Many render styles are not supported yet...
default :
RenderPass = RenderPass . Mask ;
alpha = 255 ;
break ;
Added, Visual mode, DECORATE: "Alpha" and "DefaultAlpha" properties are now supported.
Added, Visual mode, DECORATE: "RenderStyle" property is now partially supported.
Added, Visual mode, DECORATE: +BRIGHT flag is now supported.
Added, Visual mode, UDMF: "Alpha" thing property is now supported.
Added, Visual mode, UDMF: "RenderStyle" thing property is now partially supported.
Added, Visual mode, Hexen map format and UDMF: "Translucent" and "Invisible" thing flags are now supported.
Added, Game Configurations: added "alpha" and "renderstyle" Thing and Thing Category properties.
Fixed, Visual mode: blockmap was not updated when moving things using "Move Thing Left/Right/Forward/Backward" and "Move Thing to Cursor Location" actions.
DECORATE parser: added a warning when unable to find actor's parent class.
Internal: current map format can now be checked using "General.Map.UDMF", "General.Map.HEXEN" and "General.Map.DOOM" properties.
Updated documentation ("Game Configuration - Things Settings" page).
2015-09-28 14:57:48 +00:00
}
}
2015-11-13 21:42:41 +00:00
// Don't bother when alpha is unchanged, unless Additive RenderStyle is used
if ( RenderPass ! = RenderPass . Additive & & alpha = = 255 ) RenderPass = RenderPass . Mask ;
Added, Visual mode, DECORATE: "Alpha" and "DefaultAlpha" properties are now supported.
Added, Visual mode, DECORATE: "RenderStyle" property is now partially supported.
Added, Visual mode, DECORATE: +BRIGHT flag is now supported.
Added, Visual mode, UDMF: "Alpha" thing property is now supported.
Added, Visual mode, UDMF: "RenderStyle" thing property is now partially supported.
Added, Visual mode, Hexen map format and UDMF: "Translucent" and "Invisible" thing flags are now supported.
Added, Game Configurations: added "alpha" and "renderstyle" Thing and Thing Category properties.
Fixed, Visual mode: blockmap was not updated when moving things using "Move Thing Left/Right/Forward/Backward" and "Move Thing to Cursor Location" actions.
DECORATE parser: added a warning when unable to find actor's parent class.
Internal: current map format can now be checked using "General.Map.UDMF", "General.Map.HEXEN" and "General.Map.DOOM" properties.
Updated documentation ("Game Configuration - Things Settings" page).
2015-09-28 14:57:48 +00:00
int sectorcolor = new PixelColor ( alpha , 255 , 255 , 255 ) . ToInt ( ) ;
2015-10-02 14:47:34 +00:00
fogfactor = 0f ; //mxd
2009-04-19 18:07:22 +00:00
2013-03-18 13:52:27 +00:00
//mxd. Check thing size
2015-05-30 10:26:16 +00:00
float thingradius = Thing . Size ; // Thing.Size has ThingRadius arg override applied
2015-10-02 14:47:34 +00:00
thingheight = Thing . Height ; // Thing.Height has ThingHeight arg override applied
2015-05-30 10:26:16 +00:00
if ( thingradius < 0.1f | | thingheight < 0.1f )
2014-12-03 23:15:26 +00:00
{
2015-05-30 10:26:16 +00:00
thingradius = FIXED_RADIUS ;
thingheight = FIXED_RADIUS ;
2013-03-18 13:52:27 +00:00
sizeless = true ;
2014-12-03 23:15:26 +00:00
}
else
{
2013-03-18 13:52:27 +00:00
sizeless = false ;
}
2009-04-19 18:07:22 +00:00
2016-04-11 23:05:16 +00:00
if ( Thing . Sector ! = null )
2009-04-19 18:07:22 +00:00
{
2016-04-11 23:05:16 +00:00
SectorData sd = mode . GetSectorData ( Thing . Sector ) ;
2016-10-04 09:53:38 +00:00
Plane floor = sd . Floor . plane ; //mxd
2016-04-11 23:05:16 +00:00
if ( ! info . Bright )
2009-04-19 18:07:22 +00:00
{
2016-04-11 23:05:16 +00:00
Vector3D thingpos = new Vector3D ( Thing . Position . x , Thing . Position . y , Thing . Position . z + sd . Floor . plane . GetZ ( Thing . Position ) ) ;
SectorLevel level = sd . GetLevelAboveOrAt ( thingpos ) ;
Added, Visual mode, DECORATE: "Alpha" and "DefaultAlpha" properties are now supported.
Added, Visual mode, DECORATE: "RenderStyle" property is now partially supported.
Added, Visual mode, DECORATE: +BRIGHT flag is now supported.
Added, Visual mode, UDMF: "Alpha" thing property is now supported.
Added, Visual mode, UDMF: "RenderStyle" thing property is now partially supported.
Added, Visual mode, Hexen map format and UDMF: "Translucent" and "Invisible" thing flags are now supported.
Added, Game Configurations: added "alpha" and "renderstyle" Thing and Thing Category properties.
Fixed, Visual mode: blockmap was not updated when moving things using "Move Thing Left/Right/Forward/Backward" and "Move Thing to Cursor Location" actions.
DECORATE parser: added a warning when unable to find actor's parent class.
Internal: current map format can now be checked using "General.Map.UDMF", "General.Map.HEXEN" and "General.Map.DOOM" properties.
Updated documentation ("Game Configuration - Things Settings" page).
2015-09-28 14:57:48 +00:00
2016-04-11 23:05:16 +00:00
//mxd. Let's use point on floor plane instead of Thing.Sector.FloorHeight;
if ( nointeraction & & level = = null & & sd . LightLevels . Count > 0 ) level = sd . LightLevels [ sd . LightLevels . Count - 1 ] ;
Added, Visual mode, DECORATE: "Alpha" and "DefaultAlpha" properties are now supported.
Added, Visual mode, DECORATE: "RenderStyle" property is now partially supported.
Added, Visual mode, DECORATE: +BRIGHT flag is now supported.
Added, Visual mode, UDMF: "Alpha" thing property is now supported.
Added, Visual mode, UDMF: "RenderStyle" thing property is now partially supported.
Added, Visual mode, Hexen map format and UDMF: "Translucent" and "Invisible" thing flags are now supported.
Added, Game Configurations: added "alpha" and "renderstyle" Thing and Thing Category properties.
Fixed, Visual mode: blockmap was not updated when moving things using "Move Thing Left/Right/Forward/Backward" and "Move Thing to Cursor Location" actions.
DECORATE parser: added a warning when unable to find actor's parent class.
Internal: current map format can now be checked using "General.Map.UDMF", "General.Map.HEXEN" and "General.Map.DOOM" properties.
Updated documentation ("Game Configuration - Things Settings" page).
2015-09-28 14:57:48 +00:00
2016-04-11 23:05:16 +00:00
//mxd. Use the light level of the highest surface when a thing is above highest sector level.
if ( level ! = null )
{
// TECH: In GZDoom, ceiling glow doesn't affect thing brightness
// Use sector brightness for color shading
int brightness = level . brightnessbelow ;
Added, Visual mode, DECORATE: "Alpha" and "DefaultAlpha" properties are now supported.
Added, Visual mode, DECORATE: "RenderStyle" property is now partially supported.
Added, Visual mode, DECORATE: +BRIGHT flag is now supported.
Added, Visual mode, UDMF: "Alpha" thing property is now supported.
Added, Visual mode, UDMF: "RenderStyle" thing property is now partially supported.
Added, Visual mode, Hexen map format and UDMF: "Translucent" and "Invisible" thing flags are now supported.
Added, Game Configurations: added "alpha" and "renderstyle" Thing and Thing Category properties.
Fixed, Visual mode: blockmap was not updated when moving things using "Move Thing Left/Right/Forward/Backward" and "Move Thing to Cursor Location" actions.
DECORATE parser: added a warning when unable to find actor's parent class.
Internal: current map format can now be checked using "General.Map.UDMF", "General.Map.HEXEN" and "General.Map.DOOM" properties.
Updated documentation ("Game Configuration - Things Settings" page).
2015-09-28 14:57:48 +00:00
2016-11-17 00:17:34 +00:00
//mxd. Apply lightfloor value
2016-11-28 20:01:47 +00:00
// According to Graf, this is incorrect behaviour...
2016-11-17 00:17:34 +00:00
// TECH: In (G)ZDoom, this is ignored when ceiling texture is sky or a thing is below a 3D floor
// It's probably more involved than this, but for now let's do it only when there are no 3d floors in Thing.Sector...
2016-11-28 20:01:47 +00:00
/ * if ( General . Map . UDMF & & sd . LightLevels . Count = = 2 & & Thing . Sector . CeilTexture ! = General . Map . Config . SkyFlatName )
2016-11-17 00:17:34 +00:00
{
if ( sd . Sector . Fields . GetValue ( "lightfloorabsolute" , false ) )
brightness = UniFields . GetInteger ( sd . Sector . Fields , "lightfloor" ) ;
else
brightness + = UniFields . GetInteger ( sd . Sector . Fields , "lightfloor" ) ;
2016-11-28 20:01:47 +00:00
} * /
2016-11-17 00:17:34 +00:00
2016-04-11 23:05:16 +00:00
// Level is glowing
if ( level . affectedbyglow & & level . type = = SectorLevelType . Floor )
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
{
2016-04-11 23:05:16 +00:00
// Extrafloor glow doesn't affect thing brightness
if ( level . sector = = Thing . Sector )
2015-10-02 14:47:34 +00:00
{
2016-04-11 23:05:16 +00:00
float planez = level . plane . GetZ ( thingpos ) ;
// Get glow brightness
int glowbrightness = sd . FloorGlow . Brightness / 2 ;
SectorLevel nexthigher = sd . GetLevelAbove ( new Vector3D ( thingpos , planez ) ) ;
// Interpolate thing brightness between glow and regular ones
if ( nexthigher ! = null )
2015-10-02 14:47:34 +00:00
{
2016-04-11 23:05:16 +00:00
float higherz = nexthigher . plane . GetZ ( thingpos ) ;
float delta = General . Clamp ( 1.0f - ( thingpos . z - planez ) / ( higherz - planez ) , 0f , 1f ) ;
brightness = ( int ) ( ( glowbrightness + level . sector . Brightness / 2 ) * delta + nexthigher . sector . Brightness * ( 1.0f - delta ) ) ;
2015-10-02 14:47:34 +00:00
}
}
2016-04-11 23:05:16 +00:00
}
// Level below this one is glowing. Only possible for floor glow(?)
else if ( level . type = = SectorLevelType . Glow )
{
// Interpolate thing brightness between glow and regular ones
if ( sd . Floor ! = null & & sd . FloorGlow ! = null )
2015-10-02 14:47:34 +00:00
{
2016-04-11 23:05:16 +00:00
// Get glow brightness
float glowz = level . plane . GetZ ( thingpos ) ;
float floorz = floor . GetZ ( thingpos ) ;
float delta = General . Clamp ( ( thingpos . z - floorz ) / ( glowz - floorz ) , 0f , 1f ) ;
2015-11-28 20:59:32 +00:00
2016-04-11 23:05:16 +00:00
brightness = ( int ) ( ( sd . FloorGlow . Brightness / 2 + sd . Floor . sector . Brightness / 2 ) * ( 1.0f - delta ) + sd . Floor . sector . Brightness * delta ) ;
2015-10-02 14:47:34 +00:00
}
2016-04-11 23:05:16 +00:00
}
2015-10-02 14:47:34 +00:00
2016-04-11 23:05:16 +00:00
PixelColor areabrightness = PixelColor . FromInt ( mode . CalculateBrightness ( brightness ) ) ;
PixelColor areacolor = PixelColor . Modulate ( level . colorbelow , areabrightness ) ;
sectorcolor = areacolor . WithAlpha ( alpha ) . ToInt ( ) ;
Added, Visual mode, DECORATE: "Alpha" and "DefaultAlpha" properties are now supported.
Added, Visual mode, DECORATE: "RenderStyle" property is now partially supported.
Added, Visual mode, DECORATE: +BRIGHT flag is now supported.
Added, Visual mode, UDMF: "Alpha" thing property is now supported.
Added, Visual mode, UDMF: "RenderStyle" thing property is now partially supported.
Added, Visual mode, Hexen map format and UDMF: "Translucent" and "Invisible" thing flags are now supported.
Added, Game Configurations: added "alpha" and "renderstyle" Thing and Thing Category properties.
Fixed, Visual mode: blockmap was not updated when moving things using "Move Thing Left/Right/Forward/Backward" and "Move Thing to Cursor Location" actions.
DECORATE parser: added a warning when unable to find actor's parent class.
Internal: current map format can now be checked using "General.Map.UDMF", "General.Map.HEXEN" and "General.Map.DOOM" properties.
Updated documentation ("Game Configuration - Things Settings" page).
2015-09-28 14:57:48 +00:00
2016-04-11 23:05:16 +00:00
//mxd. Calculate fogfactor
fogfactor = VisualGeometry . CalculateFogFactor ( level . sector . FogMode , brightness ) ;
2012-11-27 21:12:20 +00:00
}
2016-04-11 23:05:16 +00:00
}
//TECH: even Bright Thing frames are affected by custom fade...
else
{
Vector3D thingpos = new Vector3D ( Thing . Position . x , Thing . Position . y , Thing . Position . z + sd . Floor . plane . GetZ ( Thing . Position ) ) ;
SectorLevel level = sd . GetLevelAboveOrAt ( thingpos ) ;
2015-12-01 14:51:45 +00:00
2016-04-11 23:05:16 +00:00
if ( level ! = null & & level . sector . FogMode > SectorFogMode . CLASSIC )
{
//mxd. Calculate fogfactor
fogfactor = VisualGeometry . CalculateFogFactor ( level . sector . FogMode , level . brightnessbelow ) ;
2015-12-01 14:51:45 +00:00
}
2009-04-19 18:07:22 +00:00
}
2016-04-11 23:05:16 +00:00
}
//mxd. Create verts for all sprite angles
WorldVertex [ ] [ ] allverts = new WorldVertex [ info . SpriteFrame . Length ] [ ] ;
2016-07-13 21:53:48 +00:00
Vector2D [ ] alloffsets = new Vector2D [ info . SpriteFrame . Length ] ;
2016-04-11 23:05:16 +00:00
base . textures = new ImageData [ info . SpriteFrame . Length ] ;
2016-04-19 23:20:41 +00:00
isloaded = true ;
2016-04-11 23:05:16 +00:00
for ( int i = 0 ; i < sprites . Length ; i + + )
{
2016-07-13 21:53:48 +00:00
Vector2D offsets = new Vector2D ( ) ;
2009-04-19 18:07:22 +00:00
// Check if the texture is loaded
2016-04-11 23:05:16 +00:00
ImageData sprite = sprites [ i ] ;
2009-04-19 18:07:22 +00:00
sprite . LoadImage ( ) ;
2016-04-19 23:20:41 +00:00
if ( sprite . IsImageLoaded )
2009-04-19 18:07:22 +00:00
{
2016-04-11 23:05:16 +00:00
base . textures [ i ] = sprite ;
2009-04-19 18:07:22 +00:00
// Determine sprite size and offset
float radius = sprite . ScaledWidth * 0.5f ;
float height = sprite . ScaledHeight ;
2016-07-11 22:13:43 +00:00
ISpriteImage spriteimg = sprite as ISpriteImage ;
2016-03-18 12:52:12 +00:00
if ( spriteimg ! = null )
2009-04-19 18:07:22 +00:00
{
2016-07-13 21:53:48 +00:00
offsets . x = radius - spriteimg . OffsetX ;
offsets . y = spriteimg . OffsetY - height ;
2009-04-19 18:07:22 +00:00
}
2010-07-31 21:17:49 +00:00
// Scale by thing type/actor scale
// We do this after the offset x/y determination above, because that is entirely in sprite pixels space
2010-08-02 08:08:52 +00:00
radius * = info . SpriteScale . Width ;
height * = info . SpriteScale . Height ;
2016-07-13 21:53:48 +00:00
offsets . x * = info . SpriteScale . Width ;
offsets . y * = info . SpriteScale . Height ;
2010-07-31 21:17:49 +00:00
2009-04-19 18:07:22 +00:00
// Make vertices
WorldVertex [ ] verts = new WorldVertex [ 6 ] ;
2013-03-18 13:52:27 +00:00
2016-04-11 23:05:16 +00:00
//mxd. Sprite mirroring
float ul = ( info . SpriteFrame [ i ] . Mirror ? 1f : 0f ) ;
float ur = ( info . SpriteFrame [ i ] . Mirror ? 0f : 1f ) ;
2014-12-03 23:15:26 +00:00
if ( sizeless ) //mxd
{
2013-03-18 13:52:27 +00:00
float hh = height / 2 ;
2016-07-13 21:53:48 +00:00
verts [ 0 ] = new WorldVertex ( - radius + offsets . x , 0.0f , offsets . y - hh , sectorcolor , ul , 1.0f ) ;
verts [ 1 ] = new WorldVertex ( - radius + offsets . x , 0.0f , hh + offsets . y , sectorcolor , ul , 0.0f ) ;
verts [ 2 ] = new WorldVertex ( + radius + offsets . x , 0.0f , hh + offsets . y , sectorcolor , ur , 0.0f ) ;
2013-03-18 13:52:27 +00:00
verts [ 3 ] = verts [ 0 ] ;
verts [ 4 ] = verts [ 2 ] ;
2016-07-13 21:53:48 +00:00
verts [ 5 ] = new WorldVertex ( + radius + offsets . x , 0.0f , offsets . y - hh , sectorcolor , ur , 1.0f ) ;
2014-12-03 23:15:26 +00:00
}
else
{
2016-07-13 21:53:48 +00:00
verts [ 0 ] = new WorldVertex ( - radius + offsets . x , 0.0f , offsets . y , sectorcolor , ul , 1.0f ) ;
verts [ 1 ] = new WorldVertex ( - radius + offsets . x , 0.0f , height + offsets . y , sectorcolor , ul , 0.0f ) ;
verts [ 2 ] = new WorldVertex ( + radius + offsets . x , 0.0f , height + offsets . y , sectorcolor , ur , 0.0f ) ;
2013-03-18 13:52:27 +00:00
verts [ 3 ] = verts [ 0 ] ;
verts [ 4 ] = verts [ 2 ] ;
2016-07-13 21:53:48 +00:00
verts [ 5 ] = new WorldVertex ( + radius + offsets . x , 0.0f , offsets . y , sectorcolor , ur , 1.0f ) ;
2013-03-18 13:52:27 +00:00
}
2016-04-11 23:05:16 +00:00
allverts [ i ] = verts ;
2009-04-19 18:07:22 +00:00
}
else
{
2016-04-19 23:20:41 +00:00
isloaded = false ;
2016-04-11 23:05:16 +00:00
base . textures [ i ] = General . Map . Data . Hourglass3D ;
2009-04-19 18:07:22 +00:00
// Determine sprite size
2015-05-30 10:26:16 +00:00
float radius = Math . Min ( thingradius , thingheight / 2f ) ;
float height = Math . Min ( thingradius * 2f , thingheight ) ;
2009-04-19 18:07:22 +00:00
2016-07-13 21:53:48 +00:00
//mxd. Determine sprite offsets
offsets . x = radius ;
offsets . y = height / 2 ;
2009-04-19 18:07:22 +00:00
// Make vertices
WorldVertex [ ] verts = new WorldVertex [ 6 ] ;
2014-01-03 10:33:45 +00:00
verts [ 0 ] = new WorldVertex ( - radius , 0.0f , 0.0f , sectorcolor , 0.0f , 1.0f ) ;
verts [ 1 ] = new WorldVertex ( - radius , 0.0f , height , sectorcolor , 0.0f , 0.0f ) ;
verts [ 2 ] = new WorldVertex ( + radius , 0.0f , height , sectorcolor , 1.0f , 0.0f ) ;
2009-04-19 18:07:22 +00:00
verts [ 3 ] = verts [ 0 ] ;
verts [ 4 ] = verts [ 2 ] ;
2014-01-03 10:33:45 +00:00
verts [ 5 ] = new WorldVertex ( + radius , 0.0f , 0.0f , sectorcolor , 1.0f , 1.0f ) ;
2016-04-11 23:05:16 +00:00
allverts [ i ] = verts ;
2009-04-19 18:07:22 +00:00
}
2016-07-13 21:53:48 +00:00
//mxd. Store offsets
alloffsets [ i ] = offsets ;
2009-04-19 18:07:22 +00:00
}
2016-04-11 23:05:16 +00:00
//mxd
2016-07-13 21:53:48 +00:00
SetVertices ( allverts , alloffsets /*, floor, ceiling*/ ) ;
2009-04-19 18:07:22 +00:00
// Determine position
Vector3D pos = Thing . Position ;
2012-11-27 21:12:20 +00:00
if ( Thing . Type = = 9501 )
{
2014-12-03 23:15:26 +00:00
if ( Thing . Sector ! = null ) //mxd
{
2013-07-29 08:50:50 +00:00
// This is a special thing that needs special positioning
SectorData sd = mode . GetSectorData ( Thing . Sector ) ;
pos . z = sd . Ceiling . sector . CeilHeight + Thing . Position . z ;
}
2012-11-27 21:12:20 +00:00
}
else if ( Thing . Type = = 9500 )
{
2014-12-03 23:15:26 +00:00
if ( Thing . Sector ! = null ) //mxd
{
2013-07-29 08:50:50 +00:00
// This is a special thing that needs special positioning
SectorData sd = mode . GetSectorData ( Thing . Sector ) ;
pos . z = sd . Floor . sector . FloorHeight + Thing . Position . z ;
}
2012-11-27 21:12:20 +00:00
}
else if ( info . AbsoluteZ )
2009-04-19 18:07:22 +00:00
{
// Absolute Z position
pos . z = Thing . Position . z ;
}
else if ( info . Hangs )
{
// Hang from ceiling
2012-11-27 21:12:20 +00:00
if ( Thing . Sector ! = null )
{
SectorData sd = mode . GetSectorData ( Thing . Sector ) ;
2015-01-30 08:10:49 +00:00
float maxz = sd . Ceiling . plane . GetZ ( Thing . Position ) - info . Height ;
pos . z = maxz ;
2012-11-27 21:12:20 +00:00
2015-03-26 21:31:46 +00:00
if ( Thing . Position . z > 0 | | nointeraction ) pos . z - = Thing . Position . z ;
2012-11-27 21:12:20 +00:00
2015-01-30 07:58:09 +00:00
// Check if below floor
2015-03-26 21:31:46 +00:00
if ( ! nointeraction )
{
float minz = sd . Floor . plane . GetZ ( Thing . Position ) ;
if ( pos . z < minz ) pos . z = Math . Min ( minz , maxz ) ;
}
2009-04-19 18:07:22 +00:00
}
}
else
{
// Stand on floor
2012-11-27 21:12:20 +00:00
if ( Thing . Sector ! = null )
{
SectorData sd = mode . GetSectorData ( Thing . Sector ) ;
2015-01-30 08:10:49 +00:00
float minz = sd . Floor . plane . GetZ ( Thing . Position ) ;
pos . z = minz ;
2012-11-27 21:12:20 +00:00
2015-03-26 21:31:46 +00:00
if ( Thing . Position . z > 0 | | nointeraction ) pos . z + = Thing . Position . z ;
2012-11-27 21:12:20 +00:00
2015-01-30 07:58:09 +00:00
// Check if above ceiling
2015-03-26 21:31:46 +00:00
if ( ! nointeraction )
{
float maxz = sd . Ceiling . plane . GetZ ( Thing . Position ) - info . Height ;
if ( pos . z > maxz ) pos . z = Math . Max ( minz , maxz ) ;
}
2009-04-19 18:07:22 +00:00
}
}
// Apply settings
SetPosition ( pos ) ;
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
SetCageColor ( Thing . Color ) ;
2009-04-19 18:07:22 +00:00
// Keep info for object picking
2015-05-30 10:26:16 +00:00
cageradius2 = thingradius * Angle2D . SQRT2 ;
2009-04-19 18:07:22 +00:00
cageradius2 = cageradius2 * cageradius2 ;
pos2d = pos ;
2013-03-18 13:52:27 +00:00
2014-12-03 23:15:26 +00:00
if ( sizeless ) //mxd
{
2015-05-30 10:26:16 +00:00
boxp1 = new Vector3D ( pos . x - thingradius , pos . y - thingradius , pos . z - thingradius / 2 ) ;
boxp2 = new Vector3D ( pos . x + thingradius , pos . y + thingradius , pos . z + thingradius / 2 ) ;
2014-12-03 23:15:26 +00:00
}
else
{
2015-05-30 10:26:16 +00:00
boxp1 = new Vector3D ( pos . x - thingradius , pos . y - thingradius , pos . z ) ;
boxp2 = new Vector3D ( pos . x + thingradius , pos . y + thingradius , pos . z + thingheight ) ;
2013-03-18 13:52:27 +00:00
}
2009-04-19 18:07:22 +00:00
// Done
2009-05-01 20:31:17 +00:00
changed = false ;
2009-04-19 18:07:22 +00:00
return true ;
}
// Disposing
public override void Dispose ( )
{
if ( ! IsDisposed )
{
2016-04-11 23:05:16 +00:00
if ( sprites ! = null ) //mxd
2009-04-19 18:07:22 +00:00
{
2016-04-11 23:05:16 +00:00
foreach ( ImageData sprite in sprites ) sprite . RemoveReference ( ) ;
sprites = null ;
2009-04-19 18:07:22 +00:00
}
2015-09-16 12:10:43 +00:00
base . Dispose ( ) ;
2009-04-19 18:07:22 +00:00
}
}
#endregion
#region = = = = = = = = = = = = = = = = = = Methods
// This forces to rebuild the whole thing
public void Rebuild ( )
{
2012-06-01 19:53:14 +00:00
// Find thing information
info = General . Map . Data . GetThingInfo ( Thing . Type ) ;
2012-05-11 12:28:20 +00:00
2015-03-26 21:31:46 +00:00
//mxd. When true, the thing can be moved below floor/above ceiling
nointeraction = ( info . Actor ! = null & & info . Actor . GetFlagValue ( "nointeraction" , false ) ) ;
2016-04-11 23:05:16 +00:00
//mxd. Find sprite textures
sprites = new ImageData [ info . SpriteFrame . Length ] ;
for ( int i = 0 ; i < info . SpriteFrame . Length ; i + + )
2012-06-01 19:53:14 +00:00
{
2016-04-11 23:05:16 +00:00
sprites [ i ] = General . Map . Data . GetSpriteImage ( info . SpriteFrame [ i ] . Sprite ) ;
if ( sprites [ i ] ! = null ) sprites [ i ] . AddReference ( ) ;
2012-06-01 19:53:14 +00:00
}
// Setup visual thing
2009-04-19 18:07:22 +00:00
Setup ( ) ;
}
// This updates the thing when needed
public override void Update ( )
{
if ( ! isloaded )
{
2016-04-11 23:05:16 +00:00
//mxd. Rebuild sprite geometry when all sprites are loaded
2016-04-19 23:20:41 +00:00
isloaded = true ;
2016-04-11 23:05:16 +00:00
foreach ( ImageData sprite in sprites )
2009-04-19 18:07:22 +00:00
{
2016-04-11 23:05:16 +00:00
if ( ! sprite . IsImageLoaded )
{
2016-04-19 23:20:41 +00:00
isloaded = false ;
2016-04-11 23:05:16 +00:00
break ;
}
2009-04-19 18:07:22 +00:00
}
2016-04-11 23:05:16 +00:00
2016-04-19 23:20:41 +00:00
if ( isloaded ) Setup ( ) ;
2009-04-19 18:07:22 +00:00
}
// Let the base update
base . Update ( ) ;
}
// This performs a fast test in object picking
public override bool PickFastReject ( Vector3D from , Vector3D to , Vector3D dir )
{
2016-04-13 10:07:46 +00:00
//mxd. Don't highlight when thing sprite is not rendered and thing cages are disabled
if ( ! General . Map . Renderer3D . DrawThingCages & & info . DistanceCheckSq < int . MaxValue
& & ( Thing . Position - General . Map . VisualCamera . Position ) . GetLengthSq ( ) > info . DistanceCheckSq )
return false ;
2009-04-19 18:07:22 +00:00
float distance2 = Line2D . GetDistanceToLineSq ( from , to , pos2d , false ) ;
return ( distance2 < = cageradius2 ) ;
}
// This performs an accurate test for object picking
public override bool PickAccurate ( Vector3D from , Vector3D to , Vector3D dir , ref float u_ray )
{
Vector3D delta = to - from ;
float tfar = float . MaxValue ;
float tnear = float . MinValue ;
// Ray-Box intersection code
2009-07-11 10:28:58 +00:00
// See http://www.masm32.com/board/index.php?topic=9941.0
2009-04-19 18:07:22 +00:00
// Check X slab
if ( delta . x = = 0.0f )
{
if ( from . x > boxp2 . x | | from . x < boxp1 . x )
{
// Ray is parallel to the planes & outside slab
return false ;
}
}
else
{
float tmp = 1.0f / delta . x ;
float t1 = ( boxp1 . x - from . x ) * tmp ;
float t2 = ( boxp2 . x - from . x ) * tmp ;
if ( t1 > t2 ) General . Swap ( ref t1 , ref t2 ) ;
if ( t1 > tnear ) tnear = t1 ;
if ( t2 < tfar ) tfar = t2 ;
if ( tnear > tfar | | tfar < 0.0f )
{
// Ray missed box or box is behind ray
return false ;
}
}
// Check Y slab
if ( delta . y = = 0.0f )
{
if ( from . y > boxp2 . y | | from . y < boxp1 . y )
{
// Ray is parallel to the planes & outside slab
return false ;
}
}
else
{
float tmp = 1.0f / delta . y ;
float t1 = ( boxp1 . y - from . y ) * tmp ;
float t2 = ( boxp2 . y - from . y ) * tmp ;
if ( t1 > t2 ) General . Swap ( ref t1 , ref t2 ) ;
if ( t1 > tnear ) tnear = t1 ;
if ( t2 < tfar ) tfar = t2 ;
if ( tnear > tfar | | tfar < 0.0f )
{
// Ray missed box or box is behind ray
return false ;
}
}
// Check Z slab
if ( delta . z = = 0.0f )
{
if ( from . z > boxp2 . z | | from . z < boxp1 . z )
{
// Ray is parallel to the planes & outside slab
return false ;
}
}
else
{
float tmp = 1.0f / delta . z ;
float t1 = ( boxp1 . z - from . z ) * tmp ;
float t2 = ( boxp2 . z - from . z ) * tmp ;
if ( t1 > t2 ) General . Swap ( ref t1 , ref t2 ) ;
if ( t1 > tnear ) tnear = t1 ;
if ( t2 < tfar ) tfar = t2 ;
if ( tnear > tfar | | tfar < 0.0f )
{
// Ray missed box or box is behind ray
return false ;
}
}
// Set interpolation point
u_ray = ( tnear > 0.0f ) ? tnear : tfar ;
return true ;
}
2013-04-01 11:06:01 +00:00
//mxd
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 bool IsSelected ( )
2014-12-03 23:15:26 +00:00
{
2013-04-01 11:06:01 +00:00
return selected ;
}
2009-04-19 18:07:22 +00:00
#endregion
#region = = = = = = = = = = = = = = = = = = Events
// Unused
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 void OnSelectBegin ( ) { }
public void OnEditBegin ( ) { }
public void OnMouseMove ( MouseEventArgs e ) { }
public void OnChangeTargetBrightness ( bool up ) { }
public void OnChangeTextureOffset ( int horizontal , int vertical , bool doSurfaceAngleCorrection ) { }
public void OnSelectTexture ( ) { }
public void OnCopyTexture ( ) { }
public void OnPasteTexture ( ) { }
public void OnCopyTextureOffsets ( ) { }
public void OnPasteTextureOffsets ( ) { }
public void OnTextureAlign ( bool alignx , bool aligny ) { }
public void OnToggleUpperUnpegged ( ) { }
public void OnToggleLowerUnpegged ( ) { }
2016-03-14 10:25:27 +00:00
public void OnProcess ( long deltatime ) { }
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 void OnTextureFloodfill ( ) { }
public void OnInsert ( ) { }
public void OnTextureFit ( FitTextureOptions options ) { } //mxd
public void ApplyTexture ( string texture ) { }
public void ApplyUpperUnpegged ( bool set ) { }
public void ApplyLowerUnpegged ( bool set ) { }
public void SelectNeighbours ( bool select , bool withSameTexture , bool withSameHeight ) { } //mxd
2009-04-19 18:07:22 +00:00
// Return texture name
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 string GetTextureName ( ) { return "" ; }
2009-05-01 20:31:17 +00:00
// Select or deselect
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 void OnSelectEnd ( )
2009-05-01 20:31:17 +00:00
{
2009-07-07 11:29:56 +00:00
if ( this . selected )
{
this . selected = false ;
mode . RemoveSelectedObject ( this ) ;
}
else
{
this . selected = true ;
mode . AddSelectedObject ( this ) ;
}
2009-05-01 20:31:17 +00:00
}
2012-07-05 13:48:08 +00:00
2013-09-11 09:47:53 +00:00
//mxd. Delete 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
public void OnDelete ( )
2014-12-03 23:15:26 +00:00
{
2013-07-31 12:38:47 +00:00
mode . CreateUndo ( "Delete thing" ) ;
mode . SetActionResult ( "Deleted a thing." ) ;
this . Thing . Fields . BeforeFieldsChange ( ) ;
this . Thing . Dispose ( ) ;
2013-09-11 09:47:53 +00:00
this . Dispose ( ) ;
2013-07-31 12:38:47 +00:00
General . Map . IsChanged = true ;
General . Map . ThingsFilter . Update ( ) ;
2013-09-11 09:47:53 +00:00
}
2009-04-19 18:07:22 +00:00
// Copy properties
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 void OnCopyProperties ( )
2009-04-19 18:07:22 +00:00
{
BuilderPlug . Me . CopiedThingProps = new ThingProperties ( Thing ) ;
2009-05-02 14:59:05 +00:00
mode . SetActionResult ( "Copied thing properties." ) ;
2009-04-19 18:07:22 +00:00
}
// Paste properties
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 void OnPasteProperties ( bool usecopysettings )
2009-04-19 18:07:22 +00:00
{
if ( BuilderPlug . Me . CopiedThingProps ! = null )
{
2009-05-03 19:22:32 +00:00
mode . CreateUndo ( "Paste thing properties" ) ;
2009-05-02 14:59:05 +00:00
mode . SetActionResult ( "Pasted thing properties." ) ;
2016-10-11 12:58:35 +00:00
BuilderPlug . Me . CopiedThingProps . Apply ( new List < Thing > { Thing } , usecopysettings ) ; //mxd. Added "usecopysettings"
2009-04-19 18:07:22 +00:00
Thing . UpdateConfiguration ( ) ;
this . Rebuild ( ) ;
mode . ShowTargetInfo ( ) ;
}
}
// Edit button released
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 void OnEditEnd ( )
2009-04-19 18:07:22 +00:00
{
2010-08-14 18:07:38 +00:00
if ( General . Interface . IsActiveWindow )
2009-04-19 18:07:22 +00:00
{
2013-07-19 15:30:58 +00:00
2010-08-14 18:07:38 +00:00
List < Thing > things = mode . GetSelectedThings ( ) ;
2013-07-19 15:30:58 +00:00
//mxd
updateList = new List < BaseVisualThing > ( ) ;
2014-12-03 23:15:26 +00:00
foreach ( Thing t in things )
{
2013-07-19 15:30:58 +00:00
VisualThing vt = mode . GetVisualThing ( t ) ;
2016-04-19 20:40:42 +00:00
if ( vt ! = null ) updateList . Add ( ( BaseVisualThing ) vt ) ;
2009-04-19 18:07:22 +00:00
}
2013-07-19 15:30:58 +00:00
2014-02-21 14:42:12 +00:00
General . Interface . OnEditFormValuesChanged + = Interface_OnEditFormValuesChanged ;
2013-07-19 15:30:58 +00:00
mode . StartRealtimeInterfaceUpdate ( SelectionType . Things ) ;
General . Interface . ShowEditThings ( things ) ;
mode . StopRealtimeInterfaceUpdate ( SelectionType . Things ) ;
General . Interface . OnEditFormValuesChanged - = Interface_OnEditFormValuesChanged ;
updateList . Clear ( ) ;
updateList = null ;
2009-04-19 18:07:22 +00:00
}
}
2013-07-19 15:30:58 +00:00
//mxd
2014-12-03 23:15:26 +00:00
private void Interface_OnEditFormValuesChanged ( object sender , EventArgs e )
{
foreach ( BaseVisualThing vt in updateList ) vt . Changed = true ;
2013-07-19 15:30:58 +00:00
}
Added, Visual mode, UDMF: added "Change Pitch Clockwise", "Change Pitch Counterclockwise", "Change Roll Clockwise" and "Change Roll Counterclockwise" actions.
Added, Visual mode, UDMF: added "Increase Scale" and "Decrease Scale" actions.
Added, Visual mode, UDMF: "Reset Texture Offsets" action now resets scale when used on things.
Added, Visual mode, UDMF: "Reset Local Texture Offsets" action now resets scale, pitch and roll when used on things.
Changed, Visual mode, UDMF: "Reset Texture Offsets" action now only resets texture offsets (previously it also reset texture scale).
Changed, Visual mode, UDMF: "Reset Local Texture Offsets" action now resets texture offsets, scale and brightness of sidedefs and also rotation of floors/ceilings.
Changed, Visual mode, UDMF: thing box arrow now displays pitch and roll for things, which have attached model and appropriate MODELDEF flags.
Changed, Thing Edit Form, UDMF: negative pitch and roll can now be entered.
Updated documentation.
2015-03-30 21:44:04 +00:00
//mxd
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 void OnResetTextureOffset ( )
Added, Visual mode, UDMF: added "Change Pitch Clockwise", "Change Pitch Counterclockwise", "Change Roll Clockwise" and "Change Roll Counterclockwise" actions.
Added, Visual mode, UDMF: added "Increase Scale" and "Decrease Scale" actions.
Added, Visual mode, UDMF: "Reset Texture Offsets" action now resets scale when used on things.
Added, Visual mode, UDMF: "Reset Local Texture Offsets" action now resets scale, pitch and roll when used on things.
Changed, Visual mode, UDMF: "Reset Texture Offsets" action now only resets texture offsets (previously it also reset texture scale).
Changed, Visual mode, UDMF: "Reset Local Texture Offsets" action now resets texture offsets, scale and brightness of sidedefs and also rotation of floors/ceilings.
Changed, Visual mode, UDMF: thing box arrow now displays pitch and roll for things, which have attached model and appropriate MODELDEF flags.
Changed, Thing Edit Form, UDMF: negative pitch and roll can now be entered.
Updated documentation.
2015-03-30 21:44:04 +00:00
{
mode . CreateUndo ( "Reset thing scale" ) ;
mode . SetActionResult ( "Thing scale reset." ) ;
Thing . SetScale ( 1.0f , 1.0f ) ;
// Update what must be updated
this . Changed = true ;
}
//mxd
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 void OnResetLocalTextureOffset ( )
Added, Visual mode, UDMF: added "Change Pitch Clockwise", "Change Pitch Counterclockwise", "Change Roll Clockwise" and "Change Roll Counterclockwise" actions.
Added, Visual mode, UDMF: added "Increase Scale" and "Decrease Scale" actions.
Added, Visual mode, UDMF: "Reset Texture Offsets" action now resets scale when used on things.
Added, Visual mode, UDMF: "Reset Local Texture Offsets" action now resets scale, pitch and roll when used on things.
Changed, Visual mode, UDMF: "Reset Texture Offsets" action now only resets texture offsets (previously it also reset texture scale).
Changed, Visual mode, UDMF: "Reset Local Texture Offsets" action now resets texture offsets, scale and brightness of sidedefs and also rotation of floors/ceilings.
Changed, Visual mode, UDMF: thing box arrow now displays pitch and roll for things, which have attached model and appropriate MODELDEF flags.
Changed, Thing Edit Form, UDMF: negative pitch and roll can now be entered.
Updated documentation.
2015-03-30 21:44:04 +00:00
{
mode . CreateUndo ( "Reset thing scale, pitch and roll" ) ;
mode . SetActionResult ( "Thing scale, pitch and roll reset." ) ;
Thing . SetScale ( 1.0f , 1.0f ) ;
Thing . SetPitch ( 0 ) ;
Thing . SetRoll ( 0 ) ;
// Update what must be updated
this . Changed = true ;
}
2009-04-19 18:07:22 +00:00
// Raise/lower 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
public void OnChangeTargetHeight ( int amount )
2009-04-19 18:07:22 +00:00
{
if ( General . Map . FormatInterface . HasThingHeight )
{
if ( ( General . Map . UndoRedo . NextUndo = = null ) | | ( General . Map . UndoRedo . NextUndo . TicketID ! = undoticket ) )
2009-05-03 19:22:32 +00:00
undoticket = mode . CreateUndo ( "Change thing height" ) ;
2009-04-19 18:07:22 +00:00
2014-12-22 21:36:49 +00:00
Thing . Move ( Thing . Position + new Vector3D ( 0.0f , 0.0f , ( info . Hangs ? - amount : amount ) ) ) ;
2009-04-19 18:07:22 +00:00
2009-05-02 14:59:05 +00:00
mode . SetActionResult ( "Changed thing height to " + Thing . Position . z + "." ) ;
2012-11-27 21:12:20 +00:00
// Update what must be updated
ThingData td = mode . GetThingData ( this . Thing ) ;
foreach ( KeyValuePair < Sector , bool > s in td . UpdateAlso )
{
if ( mode . VisualSectorExists ( s . Key ) )
{
BaseVisualSector vs = ( BaseVisualSector ) mode . GetVisualSector ( s . Key ) ;
vs . UpdateSectorGeometry ( s . Value ) ;
}
}
2009-05-01 20:31:17 +00:00
this . Changed = true ;
2009-04-19 18:07:22 +00:00
}
}
2012-06-29 14:03:35 +00:00
2015-01-27 14:29:23 +00:00
//mxd
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 void OnChangeScale ( int incrementX , int incrementY )
2015-01-27 14:29:23 +00:00
{
2016-04-11 23:05:16 +00:00
if ( ! General . Map . UDMF | | sprites = = null | | ! sprites [ 0 ] . IsImageLoaded ) return ;
2015-01-27 14:29:23 +00:00
if ( ( General . Map . UndoRedo . NextUndo = = null ) | | ( General . Map . UndoRedo . NextUndo . TicketID ! = undoticket ) )
undoticket = mode . CreateUndo ( "Change thing scale" ) ;
2015-03-03 09:42:54 +00:00
float scaleX = Thing . ScaleX ;
float scaleY = Thing . ScaleY ;
2016-04-11 23:05:16 +00:00
ImageData sprite = sprites [ 0 ] ;
2015-03-03 09:42:54 +00:00
2015-01-27 14:29:23 +00:00
if ( incrementX ! = 0 )
{
2015-03-03 09:42:54 +00:00
float pix = ( int ) Math . Round ( sprite . Width * scaleX ) + incrementX ;
float newscaleX = ( float ) Math . Round ( pix / sprite . Width , 3 ) ;
scaleX = ( newscaleX = = 0 ? scaleX * - 1 : newscaleX ) ;
2015-01-27 14:29:23 +00:00
}
if ( incrementY ! = 0 )
{
2015-03-03 09:42:54 +00:00
float pix = ( int ) Math . Round ( sprite . Height * scaleY ) + incrementY ;
float newscaleY = ( float ) Math . Round ( pix / sprite . Height , 3 ) ;
scaleY = ( newscaleY = = 0 ? scaleY * - 1 : newscaleY ) ;
2015-01-27 14:29:23 +00:00
}
2015-03-03 09:42:54 +00:00
Thing . SetScale ( scaleX , scaleY ) ;
mode . SetActionResult ( "Changed thing scale to " + scaleX . ToString ( "F03" , CultureInfo . InvariantCulture ) + ", " + scaleY . ToString ( "F03" , CultureInfo . InvariantCulture ) + " (" + ( int ) Math . Round ( sprite . Width * scaleX ) + " x " + ( int ) Math . Round ( sprite . Height * scaleY ) + ")." ) ;
2015-01-27 14:29:23 +00:00
// Update what must be updated
this . Changed = true ;
}
2013-09-11 09:47:53 +00:00
//mxd
Added, Visual mode, DECORATE: "Alpha" and "DefaultAlpha" properties are now supported.
Added, Visual mode, DECORATE: "RenderStyle" property is now partially supported.
Added, Visual mode, DECORATE: +BRIGHT flag is now supported.
Added, Visual mode, UDMF: "Alpha" thing property is now supported.
Added, Visual mode, UDMF: "RenderStyle" thing property is now partially supported.
Added, Visual mode, Hexen map format and UDMF: "Translucent" and "Invisible" thing flags are now supported.
Added, Game Configurations: added "alpha" and "renderstyle" Thing and Thing Category properties.
Fixed, Visual mode: blockmap was not updated when moving things using "Move Thing Left/Right/Forward/Backward" and "Move Thing to Cursor Location" actions.
DECORATE parser: added a warning when unable to find actor's parent class.
Internal: current map format can now be checked using "General.Map.UDMF", "General.Map.HEXEN" and "General.Map.DOOM" properties.
Updated documentation ("Game Configuration - Things Settings" page).
2015-09-28 14:57:48 +00:00
public void OnMove ( Vector3D newposition )
2014-12-03 23:15:26 +00:00
{
Added, Visual mode, DECORATE: "Alpha" and "DefaultAlpha" properties are now supported.
Added, Visual mode, DECORATE: "RenderStyle" property is now partially supported.
Added, Visual mode, DECORATE: +BRIGHT flag is now supported.
Added, Visual mode, UDMF: "Alpha" thing property is now supported.
Added, Visual mode, UDMF: "RenderStyle" thing property is now partially supported.
Added, Visual mode, Hexen map format and UDMF: "Translucent" and "Invisible" thing flags are now supported.
Added, Game Configurations: added "alpha" and "renderstyle" Thing and Thing Category properties.
Fixed, Visual mode: blockmap was not updated when moving things using "Move Thing Left/Right/Forward/Backward" and "Move Thing to Cursor Location" actions.
DECORATE parser: added a warning when unable to find actor's parent class.
Internal: current map format can now be checked using "General.Map.UDMF", "General.Map.HEXEN" and "General.Map.DOOM" properties.
Updated documentation ("Game Configuration - Things Settings" page).
2015-09-28 14:57:48 +00:00
if ( ( General . Map . UndoRedo . NextUndo = = null ) | | ( General . Map . UndoRedo . NextUndo . TicketID ! = undoticket ) )
2013-09-11 09:47:53 +00:00
undoticket = mode . CreateUndo ( "Move thing" ) ;
Added, Visual mode, DECORATE: "Alpha" and "DefaultAlpha" properties are now supported.
Added, Visual mode, DECORATE: "RenderStyle" property is now partially supported.
Added, Visual mode, DECORATE: +BRIGHT flag is now supported.
Added, Visual mode, UDMF: "Alpha" thing property is now supported.
Added, Visual mode, UDMF: "RenderStyle" thing property is now partially supported.
Added, Visual mode, Hexen map format and UDMF: "Translucent" and "Invisible" thing flags are now supported.
Added, Game Configurations: added "alpha" and "renderstyle" Thing and Thing Category properties.
Fixed, Visual mode: blockmap was not updated when moving things using "Move Thing Left/Right/Forward/Backward" and "Move Thing to Cursor Location" actions.
DECORATE parser: added a warning when unable to find actor's parent class.
Internal: current map format can now be checked using "General.Map.UDMF", "General.Map.HEXEN" and "General.Map.DOOM" properties.
Updated documentation ("Game Configuration - Things Settings" page).
2015-09-28 14:57:48 +00:00
Thing . Move ( newposition ) ;
2014-02-21 14:42:12 +00:00
mode . SetActionResult ( "Changed thing position to " + Thing . Position + "." ) ;
2013-09-11 09:47:53 +00:00
// Update what must be updated
ThingData td = mode . GetThingData ( this . Thing ) ;
Added, Visual mode, DECORATE: "Alpha" and "DefaultAlpha" properties are now supported.
Added, Visual mode, DECORATE: "RenderStyle" property is now partially supported.
Added, Visual mode, DECORATE: +BRIGHT flag is now supported.
Added, Visual mode, UDMF: "Alpha" thing property is now supported.
Added, Visual mode, UDMF: "RenderStyle" thing property is now partially supported.
Added, Visual mode, Hexen map format and UDMF: "Translucent" and "Invisible" thing flags are now supported.
Added, Game Configurations: added "alpha" and "renderstyle" Thing and Thing Category properties.
Fixed, Visual mode: blockmap was not updated when moving things using "Move Thing Left/Right/Forward/Backward" and "Move Thing to Cursor Location" actions.
DECORATE parser: added a warning when unable to find actor's parent class.
Internal: current map format can now be checked using "General.Map.UDMF", "General.Map.HEXEN" and "General.Map.DOOM" properties.
Updated documentation ("Game Configuration - Things Settings" page).
2015-09-28 14:57:48 +00:00
foreach ( KeyValuePair < Sector , bool > s in td . UpdateAlso )
2014-12-03 23:15:26 +00:00
{
Added, Visual mode, DECORATE: "Alpha" and "DefaultAlpha" properties are now supported.
Added, Visual mode, DECORATE: "RenderStyle" property is now partially supported.
Added, Visual mode, DECORATE: +BRIGHT flag is now supported.
Added, Visual mode, UDMF: "Alpha" thing property is now supported.
Added, Visual mode, UDMF: "RenderStyle" thing property is now partially supported.
Added, Visual mode, Hexen map format and UDMF: "Translucent" and "Invisible" thing flags are now supported.
Added, Game Configurations: added "alpha" and "renderstyle" Thing and Thing Category properties.
Fixed, Visual mode: blockmap was not updated when moving things using "Move Thing Left/Right/Forward/Backward" and "Move Thing to Cursor Location" actions.
DECORATE parser: added a warning when unable to find actor's parent class.
Internal: current map format can now be checked using "General.Map.UDMF", "General.Map.HEXEN" and "General.Map.DOOM" properties.
Updated documentation ("Game Configuration - Things Settings" page).
2015-09-28 14:57:48 +00:00
if ( mode . VisualSectorExists ( s . Key ) )
2014-12-03 23:15:26 +00:00
{
2013-09-11 09:47:53 +00:00
BaseVisualSector vs = ( BaseVisualSector ) mode . GetVisualSector ( s . Key ) ;
vs . UpdateSectorGeometry ( s . Value ) ;
}
}
this . Changed = true ;
}
//mxd
Added, Visual mode, UDMF: added "Change Pitch Clockwise", "Change Pitch Counterclockwise", "Change Roll Clockwise" and "Change Roll Counterclockwise" actions.
Added, Visual mode, UDMF: added "Increase Scale" and "Decrease Scale" actions.
Added, Visual mode, UDMF: "Reset Texture Offsets" action now resets scale when used on things.
Added, Visual mode, UDMF: "Reset Local Texture Offsets" action now resets scale, pitch and roll when used on things.
Changed, Visual mode, UDMF: "Reset Texture Offsets" action now only resets texture offsets (previously it also reset texture scale).
Changed, Visual mode, UDMF: "Reset Local Texture Offsets" action now resets texture offsets, scale and brightness of sidedefs and also rotation of floors/ceilings.
Changed, Visual mode, UDMF: thing box arrow now displays pitch and roll for things, which have attached model and appropriate MODELDEF flags.
Changed, Thing Edit Form, UDMF: negative pitch and roll can now be entered.
Updated documentation.
2015-03-30 21:44:04 +00:00
public void SetAngle ( int newangle )
2014-12-03 23:15:26 +00:00
{
2015-12-28 15:01:53 +00:00
if ( ( General . Map . UndoRedo . NextUndo = = null ) | | ( General . Map . UndoRedo . NextUndo . TicketID ! = undoticket ) )
Added, Visual mode, UDMF: added "Change Pitch Clockwise", "Change Pitch Counterclockwise", "Change Roll Clockwise" and "Change Roll Counterclockwise" actions.
Added, Visual mode, UDMF: added "Increase Scale" and "Decrease Scale" actions.
Added, Visual mode, UDMF: "Reset Texture Offsets" action now resets scale when used on things.
Added, Visual mode, UDMF: "Reset Local Texture Offsets" action now resets scale, pitch and roll when used on things.
Changed, Visual mode, UDMF: "Reset Texture Offsets" action now only resets texture offsets (previously it also reset texture scale).
Changed, Visual mode, UDMF: "Reset Local Texture Offsets" action now resets texture offsets, scale and brightness of sidedefs and also rotation of floors/ceilings.
Changed, Visual mode, UDMF: thing box arrow now displays pitch and roll for things, which have attached model and appropriate MODELDEF flags.
Changed, Thing Edit Form, UDMF: negative pitch and roll can now be entered.
Updated documentation.
2015-03-30 21:44:04 +00:00
undoticket = mode . CreateUndo ( "Change thing angle" ) ;
Thing . Rotate ( newangle ) ;
mode . SetActionResult ( "Changed thing angle to " + Thing . AngleDoom + "." ) ;
this . Changed = true ;
}
//mxd
public void SetPitch ( int newpitch )
{
if ( ! General . Map . UDMF ) return ;
if ( ( General . Map . UndoRedo . NextUndo = = null ) | | ( General . Map . UndoRedo . NextUndo . TicketID ! = undoticket ) )
undoticket = mode . CreateUndo ( "Change thing pitch" ) ;
Thing . SetPitch ( newpitch ) ;
mode . SetActionResult ( "Changed thing pitch to " + Thing . Pitch + "." ) ;
this . Changed = true ;
}
//mxd
public void SetRoll ( int newroll )
{
if ( ! General . Map . UDMF ) return ;
if ( ( General . Map . UndoRedo . NextUndo = = null ) | | ( General . Map . UndoRedo . NextUndo . TicketID ! = undoticket ) )
undoticket = mode . CreateUndo ( "Change thing roll" ) ;
Thing . SetRoll ( newroll ) ;
mode . SetActionResult ( "Changed thing roll to " + Thing . Roll + "." ) ;
2013-09-11 09:47:53 +00:00
this . Changed = true ;
}
2009-04-19 18:07:22 +00:00
#endregion
}
}