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 ;
2016-01-11 13:00:52 +00:00
using System.Drawing ;
using System.Drawing.Drawing2D ;
using System.Drawing.Imaging ;
2009-04-19 18:07:22 +00:00
using System.IO ;
2015-11-28 23:31:54 +00:00
using System.Threading ;
2014-03-03 13:40:29 +00:00
using System.Windows.Forms ;
2009-04-19 18:07:22 +00:00
using CodeImp.DoomBuilder.Config ;
2012-05-21 23:51:32 +00:00
using CodeImp.DoomBuilder.GZBuilder.Data ;
using CodeImp.DoomBuilder.GZBuilder.GZDoom ;
using CodeImp.DoomBuilder.GZBuilder.MD3 ;
2016-01-14 11:39:52 +00:00
using CodeImp.DoomBuilder.Geometry ;
2015-11-28 23:31:54 +00:00
using CodeImp.DoomBuilder.IO ;
using CodeImp.DoomBuilder.Map ;
2016-01-14 11:39:52 +00:00
using CodeImp.DoomBuilder.Rendering ;
2015-11-28 23:31:54 +00:00
using CodeImp.DoomBuilder.Windows ;
using CodeImp.DoomBuilder.ZDoom ;
2016-01-11 13:00:52 +00:00
using SlimDX ;
using SlimDX.Direct3D9 ;
2016-01-14 11:39:52 +00:00
using Matrix = SlimDX . Matrix ;
2012-05-21 23:51:32 +00:00
2009-04-19 18:07:22 +00:00
#endregion
namespace CodeImp.DoomBuilder.Data
{
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
public struct TextResource //mxd
{
public string Filename ; // Path to text file inside of Resource
public int LumpIndex ; // Text lump index if Resource is wad
internal DataReader Resource ;
public HashSet < string > Entries ; // Actors/models/sounds etc.
public override string ToString ( )
{
return Filename + ( LumpIndex ! = - 1 ? ":" + LumpIndex : "" ) + " (" + Entries . Count + " entries)" ;
}
}
2009-04-19 18:07:22 +00:00
public sealed class DataManager
{
#region = = = = = = = = = = = = = = = = = = Constants
public const string INTERNAL_PREFIX = "internal:" ;
2014-11-25 11:52:01 +00:00
public const int CLASIC_IMAGE_NAME_LENGTH = 8 ; //mxd
2009-04-19 18:07:22 +00:00
#endregion
#region = = = = = = = = = = = = = = = = = = Variables
// Data containers
private List < DataReader > containers ;
private DataReader currentreader ;
// Palette
private Playpal palette ;
// Textures, Flats and Sprites
private Dictionary < long , ImageData > textures ;
2014-11-25 11:52:01 +00:00
private Dictionary < long , long > texturenamesshorttofull ; //mxd
2009-04-19 18:07:22 +00:00
private List < string > texturenames ;
private Dictionary < long , ImageData > flats ;
2014-11-25 11:52:01 +00:00
private Dictionary < long , long > flatnamesshorttofull ; //mxd
2009-04-19 18:07:22 +00:00
private List < string > flatnames ;
private Dictionary < long , ImageData > sprites ;
private List < MatchingTextureSet > texturesets ;
private List < ResourceTextureSet > resourcetextures ;
private AllTextureSet alltextures ;
2012-04-17 19:13:47 +00:00
2013-09-11 09:47:53 +00:00
//mxd
2015-04-14 11:33:57 +00:00
private Dictionary < int , ModelData > modeldefentries ; //Thing.Type, Model entry
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
private Dictionary < int , DynamicLightData > gldefsentries ; //Thing.Type, Light entry
2015-04-14 11:33:57 +00:00
private MapInfo mapinfo ;
2015-01-25 23:22:42 +00:00
private Dictionary < string , KeyValuePair < int , int > > reverbs ; //<name, <arg1, arg2>
2015-04-14 11:33:57 +00:00
private Dictionary < long , GlowingFlatData > glowingflats ; // Texture name hash, Glowing Flat Data
2016-01-11 13:00:52 +00:00
private Dictionary < string , SkyboxInfo > skyboxes ;
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
private string [ ] soundsequences ;
private string [ ] terrainnames ;
private string [ ] damagetypes ;
//mxd. Text resources
private Dictionary < ScriptType , HashSet < TextResource > > textresources ;
2009-04-19 18:07:22 +00:00
// Background loading
private Queue < ImageData > imageque ;
private Thread backgroundloader ;
private volatile bool updatedusedtextures ;
private bool notifiedbusy ;
// Image previews
private PreviewManager previews ;
// Special images
private ImageData missingtexture3d ;
private ImageData unknowntexture3d ;
2014-01-13 08:06:56 +00:00
private UnknownImage unknownimage ; //mxd
2009-04-19 18:07:22 +00:00
private ImageData hourglass3d ;
private ImageData crosshair ;
private ImageData crosshairbusy ;
private Dictionary < string , ImageData > internalsprites ;
2009-06-04 20:21:31 +00:00
private ImageData whitetexture ;
2015-12-04 12:29:22 +00:00
private ImageData blacktexture ; //mxd
2015-07-14 23:34:31 +00:00
2016-01-11 13:00:52 +00:00
//mxd. Sky textures
private CubeTexture skybox ; // GZDoom skybox
2015-07-14 23:34:31 +00:00
//mxd. Comment icons
private ImageData [ ] commenttextures ;
2009-04-19 18:07:22 +00:00
// Used images
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
private Dictionary < long , bool > usedtextures ; //mxd
private Dictionary < long , bool > usedflats ; //mxd. Used only when MixTextursFlats is disabled
2009-04-19 18:07:22 +00:00
// Things combined with things created from Decorate
2009-08-15 08:41:43 +00:00
private DecorateParser decorate ;
2009-04-19 18:07:22 +00:00
private List < ThingCategory > thingcategories ;
private Dictionary < int , ThingTypeInfo > thingtypes ;
// Timing
2012-07-12 22:34:12 +00:00
private float loadstarttime ;
private float loadfinishtime ;
2009-04-19 18:07:22 +00:00
// Disposing
2014-02-21 14:42:12 +00:00
private bool isdisposed ;
2009-04-19 18:07:22 +00:00
#endregion
#region = = = = = = = = = = = = = = = = = = Properties
2013-09-11 09:47:53 +00:00
//mxd
2015-04-14 11:33:57 +00:00
internal Dictionary < int , ModelData > ModeldefEntries { get { return modeldefentries ; } }
internal Dictionary < int , DynamicLightData > GldefsEntries { get { return gldefsentries ; } }
public MapInfo MapInfo { get { return mapinfo ; } }
2015-01-25 23:22:42 +00:00
public Dictionary < string , KeyValuePair < int , int > > Reverbs { get { return reverbs ; } }
2015-04-14 11:33:57 +00:00
public Dictionary < long , GlowingFlatData > GlowingFlats { get { return glowingflats ; } }
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
public string [ ] SoundSequences { get { return soundsequences ; } }
public string [ ] TerrainNames { get { return terrainnames ; } }
public string [ ] DamageTypes { get { return damagetypes ; } }
internal Dictionary < ScriptType , HashSet < TextResource > > TextResources { get { return textresources ; } }
//mxd
internal IEnumerable < DataReader > Containers { get { return containers ; } }
2012-04-17 19:13:47 +00:00
2009-04-19 18:07:22 +00:00
public Playpal Palette { get { return palette ; } }
public PreviewManager Previews { get { return previews ; } }
public ICollection < ImageData > Textures { get { return textures . Values ; } }
2013-12-03 10:50:33 +00:00
public ICollection < ImageData > Flats { get { return flats . Values ; } }
2009-04-19 18:07:22 +00:00
public List < string > TextureNames { get { return texturenames ; } }
2013-12-03 10:50:33 +00:00
public List < string > FlatNames { get { return flatnames ; } }
2009-04-19 18:07:22 +00:00
public bool IsDisposed { get { return isdisposed ; } }
public ImageData MissingTexture3D { get { return missingtexture3d ; } }
public ImageData UnknownTexture3D { get { return unknowntexture3d ; } }
public ImageData Hourglass3D { get { return hourglass3d ; } }
public ImageData Crosshair3D { get { return crosshair ; } }
public ImageData CrosshairBusy3D { get { return crosshairbusy ; } }
2009-06-04 20:21:31 +00:00
public ImageData WhiteTexture { get { return whitetexture ; } }
2015-12-04 12:29:22 +00:00
public ImageData BlackTexture { get { return blacktexture ; } } //mxd
2015-07-14 23:34:31 +00:00
public ImageData [ ] CommentTextures { get { return commenttextures ; } } //mxd
2016-01-11 13:00:52 +00:00
internal CubeTexture SkyBox { get { return skybox ; } } //mxd
2009-04-19 18:07:22 +00:00
public List < ThingCategory > ThingCategories { get { return thingcategories ; } }
public ICollection < ThingTypeInfo > ThingTypes { get { return thingtypes . Values ; } }
2009-08-15 08:41:43 +00:00
public DecorateParser Decorate { get { return decorate ; } }
2009-04-19 18:07:22 +00:00
internal ICollection < MatchingTextureSet > TextureSets { get { return texturesets ; } }
internal ICollection < ResourceTextureSet > ResourceTextureSets { get { return resourcetextures ; } }
internal AllTextureSet AllTextureSet { get { return alltextures ; } }
public bool IsLoading
{
get
{
if ( imageque ! = null )
return ( backgroundloader ! = null ) & & backgroundloader . IsAlive & & ( ( imageque . Count > 0 ) | | previews . IsLoading ) ;
2013-07-29 08:50:50 +00:00
return false ;
2009-04-19 18:07:22 +00:00
}
}
#endregion
#region = = = = = = = = = = = = = = = = = = Constructor / Disposer
// Constructor
internal DataManager ( )
{
// We have no destructor
GC . SuppressFinalize ( this ) ;
2015-12-30 13:58:58 +00:00
// Load special images (mxd: the rest is loaded in LoadInternalTextures())
2015-12-04 12:29:22 +00:00
whitetexture = new ResourceImage ( "CodeImp.DoomBuilder.Resources.White.png" ) { UseColorCorrection = false } ;
2009-06-04 20:21:31 +00:00
whitetexture . LoadImage ( ) ;
whitetexture . CreateTexture ( ) ;
2015-12-04 12:29:22 +00:00
blacktexture = new ResourceImage ( "CodeImp.DoomBuilder.Resources.Black.png" ) { UseColorCorrection = false } ; //mxd
blacktexture . LoadImage ( ) ; //mxd
blacktexture . CreateTexture ( ) ; //mxd
2014-01-13 08:06:56 +00:00
unknownimage = new UnknownImage ( Properties . Resources . UnknownImage ) ; //mxd. There should be only one!
2015-07-14 23:34:31 +00:00
//mxd. Create comment icons
commenttextures = new ImageData [ ]
{
new ResourceImage ( "CodeImp.DoomBuilder.Resources.CommentRegular.png" ) ,
new ResourceImage ( "CodeImp.DoomBuilder.Resources.CommentInfo.png" ) ,
new ResourceImage ( "CodeImp.DoomBuilder.Resources.CommentQuestion.png" ) ,
new ResourceImage ( "CodeImp.DoomBuilder.Resources.CommentProblem.png" ) ,
new ResourceImage ( "CodeImp.DoomBuilder.Resources.CommentSmile.png" ) ,
} ;
//mxd. Load comment icons
2015-12-28 15:01:53 +00:00
foreach ( ImageData data in commenttextures )
2015-07-14 23:34:31 +00:00
{
data . LoadImage ( ) ;
data . CreateTexture ( ) ;
}
2009-04-19 18:07:22 +00:00
}
2009-06-04 20:21:31 +00:00
2009-04-19 18:07:22 +00:00
// Disposer
internal void Dispose ( )
{
// Not already disposed?
if ( ! isdisposed )
{
// Clean up
Unload ( ) ;
missingtexture3d . Dispose ( ) ;
missingtexture3d = null ;
unknowntexture3d . Dispose ( ) ;
unknowntexture3d = null ;
hourglass3d . Dispose ( ) ;
hourglass3d = null ;
crosshair . Dispose ( ) ;
crosshair = null ;
crosshairbusy . Dispose ( ) ;
crosshairbusy = null ;
2009-06-04 20:21:31 +00:00
whitetexture . Dispose ( ) ;
whitetexture = null ;
2015-12-04 12:29:22 +00:00
blacktexture . Dispose ( ) ; //mxd
blacktexture = null ; //mxd
2014-01-13 08:06:56 +00:00
unknownimage . Dispose ( ) ; //mxd
unknownimage = null ; //mxd
2016-01-11 13:00:52 +00:00
for ( int i = 0 ; i < commenttextures . Length ; i + + ) //mxd
{
commenttextures [ i ] . Dispose ( ) ;
commenttextures [ i ] = null ;
}
2015-09-16 12:10:43 +00:00
commenttextures = null ;
2016-01-11 13:00:52 +00:00
if ( skybox ! = null ) //mxd
{
skybox . Dispose ( ) ;
skybox = null ;
}
2009-04-19 18:07:22 +00:00
// Done
isdisposed = true ;
}
}
#endregion
#region = = = = = = = = = = = = = = = = = = Loading / Unloading
// This loads all data resources
internal void Load ( DataLocationList configlist , DataLocationList maplist , DataLocation maplocation )
{
DataLocationList all = DataLocationList . Combined ( configlist , maplist ) ;
all . Add ( maplocation ) ;
Load ( all ) ;
}
// This loads all data resources
internal void Load ( DataLocationList configlist , DataLocationList maplist )
{
DataLocationList all = DataLocationList . Combined ( configlist , maplist ) ;
Load ( all ) ;
}
// This loads all data resources
2016-01-11 13:00:52 +00:00
private void Load ( DataLocationList locations )
2009-04-19 18:07:22 +00:00
{
Dictionary < long , ImageData > texturesonly = new Dictionary < long , ImageData > ( ) ;
2009-05-12 09:50:08 +00:00
Dictionary < long , ImageData > colormapsonly = new Dictionary < long , ImageData > ( ) ;
2009-04-19 18:07:22 +00:00
Dictionary < long , ImageData > flatsonly = new Dictionary < long , ImageData > ( ) ;
2015-12-27 21:54:50 +00:00
2009-04-19 18:07:22 +00:00
// Create collections
containers = new List < DataReader > ( ) ;
textures = new Dictionary < long , ImageData > ( ) ;
flats = new Dictionary < long , ImageData > ( ) ;
sprites = new Dictionary < long , ImageData > ( ) ;
texturenames = new List < string > ( ) ;
flatnames = new List < string > ( ) ;
2014-11-25 11:52:01 +00:00
texturenamesshorttofull = new Dictionary < long , long > ( ) ; //mxd
flatnamesshorttofull = new Dictionary < long , long > ( ) ; //mxd
2009-04-19 18:07:22 +00:00
imageque = new Queue < ImageData > ( ) ;
previews = new PreviewManager ( ) ;
texturesets = new List < MatchingTextureSet > ( ) ;
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
usedtextures = new Dictionary < long , bool > ( ) ; //mxd
usedflats = new Dictionary < long , bool > ( ) ; //mxd
2014-02-26 14:11:06 +00:00
internalsprites = new Dictionary < string , ImageData > ( StringComparer . Ordinal ) ;
2009-04-19 18:07:22 +00:00
thingcategories = General . Map . Config . GetThingCategories ( ) ;
thingtypes = General . Map . Config . GetThingTypes ( ) ;
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
//mxd. Create even more collections!
modeldefentries = new Dictionary < int , ModelData > ( ) ;
gldefsentries = new Dictionary < int , DynamicLightData > ( ) ;
reverbs = new Dictionary < string , KeyValuePair < int , int > > ( StringComparer . Ordinal ) ;
glowingflats = new Dictionary < long , GlowingFlatData > ( ) ;
skyboxes = new Dictionary < string , SkyboxInfo > ( StringComparer . Ordinal ) ;
soundsequences = new string [ 0 ] ;
terrainnames = new string [ 0 ] ;
textresources = new Dictionary < ScriptType , HashSet < TextResource > > ( ) ;
damagetypes = new string [ 0 ] ;
2009-04-19 18:07:22 +00:00
// Load texture sets
foreach ( DefinedTextureSet ts in General . Map . ConfigSettings . TextureSets )
texturesets . Add ( new MatchingTextureSet ( ts ) ) ;
// Sort the texture sets
texturesets . Sort ( ) ;
// Special textures sets
alltextures = new AllTextureSet ( ) ;
resourcetextures = new List < ResourceTextureSet > ( ) ;
// Go for all locations
foreach ( DataLocation dl in locations )
{
// Nothing chosen yet
2015-12-27 21:54:50 +00:00
DataReader c = null ;
2009-04-19 18:07:22 +00:00
// TODO: Make this work more elegant using reflection.
// Make DataLocation.type of type Type and assign the
// types of the desired reader classes.
try
{
// Choose container type
switch ( dl . type )
{
// WAD file container
case DataLocation . RESOURCE_WAD :
c = new WADReader ( dl ) ;
break ;
// Directory container
case DataLocation . RESOURCE_DIRECTORY :
c = new DirectoryReader ( dl ) ;
break ;
// PK3 file container
case DataLocation . RESOURCE_PK3 :
c = new PK3Reader ( dl ) ;
break ;
}
}
catch ( Exception e )
{
// Unable to load resource
2010-10-03 16:54:38 +00:00
General . ErrorLogger . Add ( ErrorType . Error , "Unable to load resources from location \"" + dl . location + "\". Please make sure the location is accessible and not in use by another program. The resources will now be loaded with this location excluded. You may reload the resources to try again.\n" + e . GetType ( ) . Name + " when creating data reader: " + e . Message ) ;
2009-04-19 18:07:22 +00:00
General . WriteLogLine ( e . StackTrace ) ;
continue ;
}
// Add container
if ( c ! = null )
{
containers . Add ( c ) ;
resourcetextures . Add ( c . TextureSet ) ;
}
}
// Load stuff
LoadPalette ( ) ;
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
Dictionary < string , TexturesParser > cachedparsers = new Dictionary < string , TexturesParser > ( ) ; //mxd
int texcount = LoadTextures ( texturesonly , texturenamesshorttofull , cachedparsers ) ;
int flatcount = LoadFlats ( flatsonly , flatnamesshorttofull , cachedparsers ) ;
2015-12-27 21:54:50 +00:00
int colormapcount = LoadColormaps ( colormapsonly ) ;
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
LoadSprites ( cachedparsers ) ;
cachedparsers = null ; //mxd
2015-04-14 11:33:57 +00:00
//mxd. Load MAPINFO. Should happen before parisng DECORATE
2016-01-18 11:39:59 +00:00
Dictionary < int , string > spawnnums , doomednums ;
2015-04-14 11:33:57 +00:00
LoadMapInfo ( out spawnnums , out doomednums ) ;
2015-12-27 21:54:50 +00:00
int thingcount = LoadDecorateThings ( spawnnums , doomednums ) ;
int spritecount = LoadThingSprites ( ) ;
2009-04-19 18:07:22 +00:00
LoadInternalSprites ( ) ;
2015-12-30 13:58:58 +00:00
LoadInternalTextures ( ) ; //mxd
2012-05-21 23:51:32 +00:00
2015-01-25 23:22:42 +00:00
//mxd. Load more stuff
LoadReverbs ( ) ;
2015-05-28 13:45:01 +00:00
LoadSndSeq ( ) ;
2014-12-03 23:15:26 +00:00
LoadVoxels ( ) ;
2015-12-21 14:17:47 +00:00
Dictionary < string , int > actorsbyclass = CreateActorsByClassList ( ) ;
2015-04-14 11:33:57 +00:00
LoadModeldefs ( actorsbyclass ) ;
2015-12-18 10:16:53 +00:00
foreach ( Thing t in General . Map . Map . Things ) t . UpdateCache ( ) ;
2013-09-11 09:47:53 +00:00
General . MainWindow . DisplayReady ( ) ;
2009-05-12 09:50:08 +00:00
// Process colormaps (we just put them in as textures)
foreach ( KeyValuePair < long , ImageData > t in colormapsonly )
{
textures . Add ( t . Key , t . Value ) ;
texturenames . Add ( t . Value . Name ) ;
}
2009-04-19 18:07:22 +00:00
// Process textures
foreach ( KeyValuePair < long , ImageData > t in texturesonly )
{
2009-05-14 21:36:25 +00:00
if ( ! textures . ContainsKey ( t . Key ) )
{
textures . Add ( t . Key , t . Value ) ;
2015-09-01 19:44:03 +00:00
//mxd. Add both short and long names?
if ( t . Value . HasLongName ) texturenames . Add ( t . Value . ShortName ) ;
2009-05-14 21:36:25 +00:00
texturenames . Add ( t . Value . Name ) ;
}
2009-04-19 18:07:22 +00:00
}
2013-12-03 10:50:33 +00:00
// Process flats
foreach ( KeyValuePair < long , ImageData > f in flatsonly )
{
flats . Add ( f . Key , f . Value ) ;
2015-09-01 19:44:03 +00:00
//mxd. Add both short and long names?
if ( f . Value . HasLongName ) flatnames . Add ( f . Value . ShortName ) ;
2013-12-03 10:50:33 +00:00
flatnames . Add ( f . Value . Name ) ;
}
2009-04-19 18:07:22 +00:00
// Mixed textures and flats?
2015-09-01 19:44:03 +00:00
if ( General . Map . Config . MixTexturesFlats )
2014-12-03 09:06:05 +00:00
{
2013-12-03 10:50:33 +00:00
// Add textures to flats
foreach ( KeyValuePair < long , ImageData > t in texturesonly )
{
if ( ! flats . ContainsKey ( t . Key ) )
{
flats . Add ( t . Key , t . Value ) ;
2015-09-01 19:44:03 +00:00
//mxd. Add both short and long names?
if ( t . Value . HasLongName ) flatnames . Add ( t . Value . ShortName ) ;
2013-12-03 10:50:33 +00:00
flatnames . Add ( t . Value . Name ) ;
}
2014-07-07 14:48:29 +00:00
else if ( t . Value is HighResImage | | t . Value is SimpleTextureImage ) //mxd. Textures defined in TEXTURES or placed between TX_START and TX_END markers override "regular" flats in ZDoom
2014-07-07 08:42:46 +00:00
{
2014-12-03 09:06:05 +00:00
//TODO: check this!
2014-07-07 08:42:46 +00:00
flats [ t . Key ] = t . Value ;
}
2013-12-03 10:50:33 +00:00
}
2014-12-03 09:06:05 +00:00
//mxd
2015-09-01 19:44:03 +00:00
foreach ( KeyValuePair < long , long > t in texturenamesshorttofull )
if ( ! flatnamesshorttofull . ContainsKey ( t . Key ) ) flatnamesshorttofull . Add ( t . Key , t . Value ) ;
2014-12-03 09:06:05 +00:00
2009-04-19 18:07:22 +00:00
// Add flats to textures
2013-12-03 10:50:33 +00:00
foreach ( KeyValuePair < long , ImageData > f in flatsonly )
{
if ( ! textures . ContainsKey ( f . Key ) )
{
2009-04-19 18:07:22 +00:00
textures . Add ( f . Key , f . Value ) ;
2015-09-01 19:44:03 +00:00
//mxd. Add both short and long names?
if ( f . Value . HasLongName ) texturenames . Add ( f . Value . ShortName ) ;
2009-04-19 18:07:22 +00:00
texturenames . Add ( f . Value . Name ) ;
}
}
2010-08-12 19:59:06 +00:00
2014-12-03 09:06:05 +00:00
//mxd
2015-09-01 19:44:03 +00:00
foreach ( KeyValuePair < long , long > t in flatnamesshorttofull )
if ( ! texturenamesshorttofull . ContainsKey ( t . Key ) ) texturenamesshorttofull . Add ( t . Key , t . Value ) ;
2014-12-03 09:06:05 +00:00
2010-08-12 19:59:06 +00:00
// Do the same on the data readers
2015-09-01 19:44:03 +00:00
foreach ( DataReader dr in containers )
2010-08-12 19:59:06 +00:00
dr . TextureSet . MixTexturesAndFlats ( ) ;
2009-04-19 18:07:22 +00:00
}
2015-04-14 11:33:57 +00:00
//mxd. Should be done after loading textures...
LoadGldefs ( actorsbyclass ) ;
2015-12-18 10:16:53 +00:00
//mxd. Create camera textures. Should be done after loading textures.
LoadAnimdefs ( ) ;
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
//mxd
LoadTerrain ( ) ;
2009-04-19 18:07:22 +00:00
// Sort names
texturenames . Sort ( ) ;
flatnames . Sort ( ) ;
// Sort things
foreach ( ThingCategory tc in thingcategories ) tc . SortIfNeeded ( ) ;
// Update the used textures
General . Map . Data . UpdateUsedTextures ( ) ;
// Add texture names to texture sets
foreach ( KeyValuePair < long , ImageData > img in textures )
{
2013-07-29 08:50:50 +00:00
// Add to all sets
2009-04-19 18:07:22 +00:00
foreach ( MatchingTextureSet ms in texturesets )
2013-07-29 08:50:50 +00:00
ms . AddTexture ( img . Value ) ;
2009-04-19 18:07:22 +00:00
// Add to all
alltextures . AddTexture ( img . Value ) ;
}
// Add flat names to texture sets
foreach ( KeyValuePair < long , ImageData > img in flats )
{
2013-07-29 08:50:50 +00:00
// Add to all sets
2009-04-19 18:07:22 +00:00
foreach ( MatchingTextureSet ms in texturesets )
2013-07-29 08:50:50 +00:00
ms . AddFlat ( img . Value ) ;
2009-04-19 18:07:22 +00:00
// Add to all
alltextures . AddFlat ( img . Value ) ;
}
2016-01-14 22:15:54 +00:00
//mxd. Create skybox texture(s)
SetupSkybox ( ) ;
2009-04-19 18:07:22 +00:00
// Start background loading
StartBackgroundLoader ( ) ;
// Output info
2015-04-14 11:33:57 +00:00
General . WriteLogLine ( "Loaded " + texcount + " textures, " + flatcount + " flats, " +
colormapcount + " colormaps, " + spritecount + " sprites, " +
thingcount + " decorate things, " + modeldefentries . Count + " model/voxel deinitions, " +
gldefsentries . Count + " dynamic light definitions, " +
2016-01-11 13:00:52 +00:00
glowingflats . Count + " glowing flat definitions, " + skyboxes . Count + " skybox definitions, " +
reverbs . Count + " sound environment definitions" ) ;
2009-04-19 18:07:22 +00:00
}
// This unloads all data
2014-12-03 09:06:05 +00:00
private void Unload ( )
2009-04-19 18:07:22 +00:00
{
// Stop background loader
StopBackgroundLoader ( ) ;
// Dispose preview manager
previews . Dispose ( ) ;
previews = null ;
2010-08-19 15:06:15 +00:00
// Dispose decorate
decorate . Dispose ( ) ;
2009-04-19 18:07:22 +00:00
// Dispose resources
foreach ( KeyValuePair < long , ImageData > i in textures ) i . Value . Dispose ( ) ;
foreach ( KeyValuePair < long , ImageData > i in flats ) i . Value . Dispose ( ) ;
foreach ( KeyValuePair < long , ImageData > i in sprites ) i . Value . Dispose ( ) ;
2016-02-06 00:04:02 +00:00
foreach ( KeyValuePair < string , ImageData > i in internalsprites ) i . Value . Dispose ( ) ; //mxd
2009-04-19 18:07:22 +00:00
palette = null ;
2012-05-21 23:51:32 +00:00
2015-09-16 12:10:43 +00:00
//mxd. Dispose models
foreach ( KeyValuePair < int , ModelData > i in modeldefentries ) i . Value . Dispose ( ) ;
2009-04-19 18:07:22 +00:00
// Dispose containers
foreach ( DataReader c in containers ) c . Dispose ( ) ;
containers . Clear ( ) ;
// Trash collections
2010-08-19 15:06:15 +00:00
decorate = null ;
2009-04-19 18:07:22 +00:00
containers = null ;
textures = null ;
flats = null ;
sprites = null ;
2016-02-01 22:04:00 +00:00
modeldefentries = null ; //mxd
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
gldefsentries = null ; //mxd
reverbs = null ; //mxd
glowingflats = null ; //mxd
skyboxes = null ; //mxd
soundsequences = null ; //mxd
terrainnames = null ; //mxd
textresources = null ; //mxd
damagetypes = null ; //mxd
2009-04-19 18:07:22 +00:00
texturenames = null ;
flatnames = null ;
imageque = null ;
internalsprites = null ;
2015-09-16 12:10:43 +00:00
mapinfo = null ; //mxd
2009-04-19 18:07:22 +00:00
}
#endregion
#region = = = = = = = = = = = = = = = = = = Suspend / Resume
// This suspends data resources
internal void Suspend ( )
{
// Stop background loader
StopBackgroundLoader ( ) ;
// Go for all containers
foreach ( DataReader d in containers )
{
// Suspend
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
General . WriteLogLine ( "Suspended data resource \"" + d . Location . location + "\"" ) ;
2009-04-19 18:07:22 +00:00
d . Suspend ( ) ;
}
}
// This resumes data resources
internal void Resume ( )
{
// Go for all containers
foreach ( DataReader d in containers )
{
try
{
// Resume
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
General . WriteLogLine ( "Resumed data resource \"" + d . Location . location + "\"" ) ;
2009-04-19 18:07:22 +00:00
d . Resume ( ) ;
}
catch ( Exception e )
{
// Unable to load resource
2009-05-10 16:02:08 +00:00
General . ErrorLogger . Add ( ErrorType . Error , "Unable to load resources from location \"" + d . Location . location + "\". Please make sure the location is accessible and not in use by another program. The resources will now be loaded with this location excluded. You may reload the resources to try again.\n" + e . GetType ( ) . Name + " when resuming data reader: " + e . Message + ")" ) ;
2009-04-19 18:07:22 +00:00
General . WriteLogLine ( e . StackTrace ) ;
}
}
// Start background loading
StartBackgroundLoader ( ) ;
}
#endregion
#region = = = = = = = = = = = = = = = = = = Background Loading
// This starts background loading
private void StartBackgroundLoader ( )
{
// Timing
2014-05-20 09:09:28 +00:00
loadstarttime = Clock . CurrentTime ;
2009-04-19 18:07:22 +00:00
loadfinishtime = 0 ;
// If a loader is already running, stop it first
if ( backgroundloader ! = null ) StopBackgroundLoader ( ) ;
// Start a low priority thread to load images in background
General . WriteLogLine ( "Starting background resource loading..." ) ;
2014-01-30 14:52:08 +00:00
backgroundloader = new Thread ( BackgroundLoad ) ;
2009-04-19 18:07:22 +00:00
backgroundloader . Name = "Background Loader" ;
backgroundloader . Priority = ThreadPriority . Lowest ;
backgroundloader . IsBackground = true ;
backgroundloader . Start ( ) ;
}
// This stops background loading
private void StopBackgroundLoader ( )
{
General . WriteLogLine ( "Stopping background resource loading..." ) ;
if ( backgroundloader ! = null )
{
// Stop the thread and wait for it to end
backgroundloader . Interrupt ( ) ;
backgroundloader . Join ( ) ;
// Reset load states on all images in the list
while ( imageque . Count > 0 )
{
2015-12-28 15:01:53 +00:00
ImageData img = imageque . Dequeue ( ) ;
2009-04-19 18:07:22 +00:00
switch ( img . ImageState )
{
case ImageLoadState . Loading :
img . ImageState = ImageLoadState . None ;
break ;
case ImageLoadState . Unloading :
img . ImageState = ImageLoadState . Ready ;
break ;
}
switch ( img . PreviewState )
{
case ImageLoadState . Loading :
img . PreviewState = ImageLoadState . None ;
break ;
case ImageLoadState . Unloading :
img . PreviewState = ImageLoadState . Ready ;
break ;
}
}
// Done
notifiedbusy = false ;
backgroundloader = null ;
General . SendMessage ( General . MainWindow . Handle , ( int ) MainForm . ThreadMessages . UpdateStatus , 0 , 0 ) ;
}
}
// The background loader
private void BackgroundLoad ( )
{
try
{
do
{
// Do we have to update the used-in-map status?
if ( updatedusedtextures ) BackgroundUpdateUsedTextures ( ) ;
// Get next item
ImageData image = null ;
lock ( imageque )
{
// Fetch next image to process
if ( imageque . Count > 0 ) image = imageque . Dequeue ( ) ;
}
// Any image to process?
if ( image ! = null )
{
// Load this image?
if ( image . IsReferenced & & ( image . ImageState ! = ImageLoadState . Ready ) )
{
image . LoadImage ( ) ;
}
// Unload this image?
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
else if ( ! image . IsReferenced & & image . AllowUnload & & ( image . ImageState ! = ImageLoadState . None ) )
2009-04-19 18:07:22 +00:00
{
// Still unreferenced?
image . UnloadImage ( ) ;
}
}
// Doing something?
if ( image ! = null )
{
// Wait a bit and update icon
if ( ! notifiedbusy )
{
notifiedbusy = true ;
General . SendMessage ( General . MainWindow . Handle , ( int ) MainForm . ThreadMessages . UpdateStatus , 0 , 0 ) ;
}
Thread . Sleep ( 0 ) ;
}
else
{
// Process previews only when we don't have images to process
// because these are lower priority than the actual images
if ( previews . BackgroundLoad ( ) )
{
// Wait a bit and update icon
if ( ! notifiedbusy )
{
notifiedbusy = true ;
General . SendMessage ( General . MainWindow . Handle , ( int ) MainForm . ThreadMessages . UpdateStatus , 0 , 0 ) ;
}
Thread . Sleep ( 0 ) ;
}
else
{
if ( notifiedbusy )
{
notifiedbusy = false ;
General . SendMessage ( General . MainWindow . Handle , ( int ) MainForm . ThreadMessages . UpdateStatus , 0 , 0 ) ;
}
// Timing
if ( loadfinishtime = = 0 )
{
2014-10-15 08:36:17 +00:00
//mxd. Release PK3 files
2015-12-28 15:01:53 +00:00
foreach ( DataReader reader in containers )
2014-10-15 08:36:17 +00:00
{
2015-12-28 15:01:53 +00:00
if ( reader is PK3Reader ) ( reader as PK3Reader ) . BathMode = false ;
2014-10-15 08:36:17 +00:00
}
2014-05-20 09:09:28 +00:00
loadfinishtime = Clock . CurrentTime ;
2012-07-12 22:34:12 +00:00
float deltatimesec = ( loadfinishtime - loadstarttime ) / 1000.0f ;
2009-04-19 18:07:22 +00:00
General . WriteLogLine ( "Resources loading took " + deltatimesec . ToString ( "########0.00" ) + " seconds" ) ;
}
// Wait longer to release CPU resources
Thread . Sleep ( 50 ) ;
}
}
}
while ( true ) ;
}
catch ( ThreadInterruptedException )
{
return ;
}
}
// This adds an image for background loading or unloading
internal void ProcessImage ( ImageData img )
{
// Load this image?
if ( ( img . ImageState = = ImageLoadState . None ) & & img . IsReferenced )
{
// Add for loading
img . ImageState = ImageLoadState . Loading ;
lock ( imageque ) { imageque . Enqueue ( img ) ; }
}
// Unload this image?
2010-08-11 20:32:14 +00:00
if ( ( img . ImageState = = ImageLoadState . Ready ) & & ! img . IsReferenced & & img . AllowUnload )
2009-04-19 18:07:22 +00:00
{
// Add for unloading
img . ImageState = ImageLoadState . Unloading ;
lock ( imageque ) { imageque . Enqueue ( img ) ; }
}
// Update icon
General . SendMessage ( General . MainWindow . Handle , ( int ) MainForm . ThreadMessages . UpdateStatus , 0 , 0 ) ;
}
2013-07-29 08:50:50 +00:00
//mxd. This loads a model
2014-12-03 09:06:05 +00:00
internal bool ProcessModel ( int type )
{
2015-04-14 11:33:57 +00:00
if ( modeldefentries [ type ] . LoadState ! = ModelLoadState . None ) return true ;
2013-07-29 08:50:50 +00:00
//create models
2015-04-14 11:33:57 +00:00
ModelReader . Load ( modeldefentries [ type ] , containers , General . Map . Graphics . Device ) ;
2013-07-29 08:50:50 +00:00
2015-04-14 11:33:57 +00:00
if ( modeldefentries [ type ] . Model ! = null )
2014-12-03 09:06:05 +00:00
{
2015-04-14 11:33:57 +00:00
modeldefentries [ type ] . LoadState = ModelLoadState . Ready ;
2013-07-30 09:25:27 +00:00
return true ;
2013-07-29 08:50:50 +00:00
}
2013-07-30 09:25:27 +00:00
2015-04-14 11:33:57 +00:00
modeldefentries . Remove ( type ) ;
2013-07-30 09:25:27 +00:00
return false ;
2013-07-29 08:50:50 +00:00
}
2009-04-19 18:07:22 +00:00
// This updates the used-in-map status on all textures and flats
private void BackgroundUpdateUsedTextures ( )
{
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
if ( General . Map . Config . MixTexturesFlats )
2009-04-19 18:07:22 +00:00
{
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
lock ( usedtextures )
2009-04-19 18:07:22 +00:00
{
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
// Set used on all textures
foreach ( KeyValuePair < long , ImageData > i in textures )
{
i . Value . SetUsedInMap ( usedtextures . ContainsKey ( i . Key ) ) ;
if ( i . Value . IsImageLoaded ! = i . Value . IsReferenced ) ProcessImage ( i . Value ) ;
}
// Set used on all flats
foreach ( KeyValuePair < long , ImageData > i in flats )
{
i . Value . SetUsedInMap ( usedtextures . ContainsKey ( i . Key ) ) ;
if ( i . Value . IsImageLoaded ! = i . Value . IsReferenced ) ProcessImage ( i . Value ) ;
}
}
}
//mxd. Use separate collections
else
{
lock ( usedtextures )
{
// Set used on all textures
foreach ( KeyValuePair < long , ImageData > i in textures )
{
i . Value . SetUsedInMap ( usedtextures . ContainsKey ( i . Key ) ) ;
if ( i . Value . IsImageLoaded ! = i . Value . IsReferenced ) ProcessImage ( i . Value ) ;
}
2009-04-19 18:07:22 +00:00
}
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
lock ( usedflats )
2014-12-03 09:06:05 +00:00
{
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
// Set used on all flats
foreach ( KeyValuePair < long , ImageData > i in flats )
{
i . Value . SetUsedInMap ( usedflats . ContainsKey ( i . Key ) ) ;
if ( i . Value . IsImageLoaded ! = i . Value . IsReferenced ) ProcessImage ( i . Value ) ;
}
2009-04-19 18:07:22 +00:00
}
}
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
// Done
updatedusedtextures = false ;
2009-04-19 18:07:22 +00:00
}
#endregion
#region = = = = = = = = = = = = = = = = = = Palette
// This loads the PLAYPAL palette
private void LoadPalette ( )
{
// Go for all opened containers
for ( int i = containers . Count - 1 ; i > = 0 ; i - - )
{
// Load palette
palette = containers [ i ] . LoadPalette ( ) ;
if ( palette ! = null ) break ;
}
// Make empty palette when still no palette found
if ( palette = = null )
{
2009-05-10 16:02:08 +00:00
General . ErrorLogger . Add ( ErrorType . Warning , "None of the loaded resources define a color palette. Did you forget to configure an IWAD for this game configuration?" ) ;
2009-04-19 18:07:22 +00:00
palette = new Playpal ( ) ;
}
}
#endregion
2009-05-12 09:50:08 +00:00
#region = = = = = = = = = = = = = = = = = = Colormaps
// This loads the colormaps
private int LoadColormaps ( Dictionary < long , ImageData > list )
{
int counter = 0 ;
// Go for all opened containers
foreach ( DataReader dr in containers )
{
// Load colormaps
2015-12-28 15:01:53 +00:00
ICollection < ImageData > images = dr . LoadColormaps ( ) ;
2009-05-12 09:50:08 +00:00
if ( images ! = null )
{
// Go for all colormaps
foreach ( ImageData img in images )
{
// Add or replace in flats list
list . Remove ( img . LongName ) ;
list . Add ( img . LongName , img ) ;
counter + + ;
// Add to preview manager
previews . AddImage ( img ) ;
}
}
}
// Output info
return counter ;
}
// This returns a specific colormap stream
internal Stream GetColormapData ( string pname )
{
// Go for all opened containers
for ( int i = containers . Count - 1 ; i > = 0 ; i - - )
{
// This contain provides this flat?
2015-12-28 15:01:53 +00:00
Stream colormap = containers [ i ] . GetColormapData ( pname ) ;
2009-05-12 09:50:08 +00:00
if ( colormap ! = null ) return colormap ;
}
// No such patch found
return null ;
}
#endregion
2009-04-19 18:07:22 +00:00
#region = = = = = = = = = = = = = = = = = = Textures
2009-05-12 09:50:08 +00:00
2009-04-19 18:07:22 +00:00
// This loads the textures
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
private int LoadTextures ( Dictionary < long , ImageData > list , Dictionary < long , long > nametranslation , Dictionary < string , TexturesParser > cachedparsers )
2009-04-19 18:07:22 +00:00
{
PatchNames pnames = new PatchNames ( ) ;
int counter = 0 ;
// Go for all opened containers
foreach ( DataReader dr in containers )
{
// Load PNAMES info
// Note that pnames is NOT set to null in the loop
// because if a container has no pnames, the pnames
// of the previous (higher) container should be used.
2015-12-28 15:01:53 +00:00
PatchNames newpnames = dr . LoadPatchNames ( ) ;
2009-04-19 18:07:22 +00:00
if ( newpnames ! = null ) pnames = newpnames ;
// Load textures
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
IEnumerable < ImageData > images = dr . LoadTextures ( pnames , cachedparsers ) ;
2009-04-19 18:07:22 +00:00
if ( images ! = null )
{
// Go for all textures
foreach ( ImageData img in images )
{
// Add or replace in textures list
list . Remove ( img . LongName ) ;
list . Add ( img . LongName , img ) ;
counter + + ;
2014-12-03 09:06:05 +00:00
//mxd. Also add as short name when texture name is longer than 8 chars
// Or remove when a wad image with short name overrides previously added
// resource image with long name
if ( img . HasLongName )
{
long longshortname = Lump . MakeLongName ( Path . GetFileNameWithoutExtension ( img . Name ) , false ) ;
nametranslation . Remove ( longshortname ) ;
nametranslation . Add ( longshortname , img . LongName ) ;
}
2015-12-18 10:16:53 +00:00
else if ( img is TextureImage & & nametranslation . ContainsKey ( img . LongName ) )
2014-12-03 09:06:05 +00:00
{
nametranslation . Remove ( img . LongName ) ;
}
2009-04-19 18:07:22 +00:00
// Add to preview manager
previews . AddImage ( img ) ;
}
}
}
// Output info
return counter ;
}
// This returns a specific patch stream
2014-11-25 11:52:01 +00:00
internal Stream GetPatchData ( string pname , bool longname )
2009-04-19 18:07:22 +00:00
{
// Go for all opened containers
2013-07-29 08:50:50 +00:00
for ( int i = containers . Count - 1 ; i > - 1 ; i - - )
2009-04-19 18:07:22 +00:00
{
// This contain provides this patch?
2015-12-28 15:01:53 +00:00
Stream patch = containers [ i ] . GetPatchData ( pname , longname ) ;
2009-04-19 18:07:22 +00:00
if ( patch ! = null ) return patch ;
}
// No such patch found
return null ;
}
// This returns a specific texture stream
2014-11-25 11:52:01 +00:00
internal Stream GetTextureData ( string pname , bool longname )
2009-04-19 18:07:22 +00:00
{
// Go for all opened containers
for ( int i = containers . Count - 1 ; i > = 0 ; i - - )
{
2016-01-13 09:34:32 +00:00
// This container provides this patch?
2015-12-28 15:01:53 +00:00
Stream patch = containers [ i ] . GetTextureData ( pname , longname ) ;
2009-04-19 18:07:22 +00:00
if ( patch ! = null ) return patch ;
}
// No such patch found
return null ;
}
2010-08-12 09:01:22 +00:00
// This checks if a given texture is known
public bool GetTextureExists ( string name )
{
2015-01-16 13:14:57 +00:00
return GetTextureExists ( Lump . MakeLongName ( name ) ) ; //mxd
2010-08-12 09:01:22 +00:00
}
// This checks if a given texture is known
public bool GetTextureExists ( long longname )
{
2014-12-03 09:06:05 +00:00
return textures . ContainsKey ( longname ) | | texturenamesshorttofull . ContainsKey ( longname ) ;
2010-08-12 09:01:22 +00:00
}
2009-04-19 18:07:22 +00:00
// This returns an image by string
public ImageData GetTextureImage ( string name )
{
// Get the long name
long longname = Lump . MakeLongName ( name ) ;
return GetTextureImage ( longname ) ;
}
2010-08-12 09:01:22 +00:00
2009-04-19 18:07:22 +00:00
// This returns an image by long
public ImageData GetTextureImage ( long longname )
{
// Does this texture exist?
2015-01-23 21:51:11 +00:00
if ( textures . ContainsKey ( longname ) & & textures [ longname ] is HighResImage ) return textures [ longname ] ; //TEXTURES textures should still override regular ones...
2014-12-03 09:06:05 +00:00
if ( texturenamesshorttofull . ContainsKey ( longname ) ) return textures [ texturenamesshorttofull [ longname ] ] ; //mxd
if ( textures . ContainsKey ( longname ) ) return textures [ longname ] ;
2013-07-23 14:25:03 +00:00
// Return null image
2014-01-13 08:06:56 +00:00
return unknownimage ; //mxd
2009-04-19 18:07:22 +00:00
}
2014-11-25 11:52:01 +00:00
2016-01-13 09:34:32 +00:00
//mxd. This tries to find and load any image with given name
internal Bitmap GetTextureBitmap ( string name )
{
// Check the textures first...
ImageData img = GetTextureImage ( name ) ;
if ( img is UnknownImage & & ! General . Map . Config . MixTexturesFlats )
img = GetFlatImage ( name ) ;
if ( ! ( img is UnknownImage ) )
{
if ( ! img . IsImageLoaded ) img . LoadImage ( ) ;
if ( ! img . LoadFailed )
{
return new Bitmap ( img . GetBitmap ( ) ) ;
}
}
// Try to find any image...
for ( int i = containers . Count - 1 ; i > = 0 ; i - - )
{
// This container has a lump with given name?
if ( containers [ i ] is PK3StructuredReader )
{
2016-01-15 22:19:48 +00:00
string foundname = ( ( PK3StructuredReader ) containers [ i ] ) . FindFirstFile ( name , true ) ;
if ( string . IsNullOrEmpty ( foundname ) ) continue ;
name = foundname ;
2016-01-13 09:34:32 +00:00
}
else if ( ! ( containers [ i ] is WADReader ) )
{
throw new NotImplementedException ( "Unsupported container type!" ) ;
}
if ( ! containers [ i ] . FileExists ( name ) ) continue ;
MemoryStream mem = containers [ i ] . LoadFile ( name ) ;
if ( mem = = null ) continue ;
// Is it an image?
IImageReader reader = ImageDataFormat . GetImageReader ( mem , ImageDataFormat . DOOMPICTURE , General . Map . Data . Palette ) ;
if ( ! ( reader is UnknownImageReader ) )
{
// Load the image
mem . Seek ( 0 , SeekOrigin . Begin ) ;
Bitmap result ;
try { result = reader . ReadAsBitmap ( mem ) ; }
catch ( InvalidDataException )
{
// Data cannot be read!
result = null ;
}
// Found it?
if ( result ! = null ) return result ;
}
}
// No such image found
return null ;
}
2014-11-25 11:52:01 +00:00
//mxd
public string GetFullTextureName ( string name )
{
2016-01-13 09:34:32 +00:00
if ( string . IsNullOrEmpty ( name ) ) return name ;
2015-12-28 15:01:53 +00:00
if ( Path . GetFileNameWithoutExtension ( name ) = = name & & name . Length > CLASIC_IMAGE_NAME_LENGTH )
2014-11-25 11:52:01 +00:00
name = name . Substring ( 0 , CLASIC_IMAGE_NAME_LENGTH ) ;
long hash = MurmurHash2 . Hash ( name . Trim ( ) . ToUpperInvariant ( ) ) ;
2014-12-03 09:06:05 +00:00
2015-01-23 21:51:11 +00:00
if ( textures . ContainsKey ( hash ) & & textures [ hash ] is HighResImage ) return textures [ hash ] . Name ; //TEXTURES textures should still override regular ones...
2014-11-25 11:52:01 +00:00
if ( texturenamesshorttofull . ContainsKey ( hash ) ) return textures [ texturenamesshorttofull [ hash ] ] . Name ;
2014-12-03 09:06:05 +00:00
if ( textures . ContainsKey ( hash ) ) return textures [ hash ] . Name ;
2014-11-25 11:52:01 +00:00
return name ;
}
2014-12-03 09:06:05 +00:00
//mxd
internal long GetFullLongTextureName ( long hash )
{
2015-01-23 21:51:11 +00:00
if ( textures . ContainsKey ( hash ) & & textures [ hash ] is HighResImage ) return hash ; //TEXTURES textures should still override regular ones...
2014-12-03 09:06:05 +00:00
return ( General . Map . Config . UseLongTextureNames & & texturenamesshorttofull . ContainsKey ( hash ) ? texturenamesshorttofull [ hash ] : hash ) ;
}
2015-12-30 13:58:58 +00:00
//mxd
private void LoadInternalTextures ( )
{
missingtexture3d = LoadInternalTexture ( "MissingTexture3D.png" ) ; //mxd
unknowntexture3d = LoadInternalTexture ( "UnknownTexture3D.png" ) ; //mxd
hourglass3d = LoadInternalTexture ( "Hourglass3D.png" ) ; //mxd
crosshair = LoadInternalTexture ( "Crosshair.png" ) ; //mxd
crosshairbusy = LoadInternalTexture ( "CrosshairBusy.png" ) ; //mxd
}
//mxd
private static ImageData LoadInternalTexture ( string name )
{
ImageData result ;
string path = Path . Combine ( General . TexturesPath , name ) ;
if ( File . Exists ( path ) )
{
result = new FileImage ( name , path ) { AllowUnload = false } ;
}
else
{
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
General . ErrorLogger . Add ( ErrorType . Warning , "Unable to load editor texture \"" + name + "\". Using built-in one instead." ) ;
2015-12-30 13:58:58 +00:00
result = new ResourceImage ( "CodeImp.DoomBuilder.Resources." + name ) ;
}
result . LoadImage ( ) ;
return result ;
}
2009-04-19 18:07:22 +00:00
#endregion
#region = = = = = = = = = = = = = = = = = = Flats
// This loads the flats
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
private int LoadFlats ( Dictionary < long , ImageData > list , Dictionary < long , long > nametranslation , Dictionary < string , TexturesParser > cachedparsers )
2009-04-19 18:07:22 +00:00
{
int counter = 0 ;
// Go for all opened containers
foreach ( DataReader dr in containers )
{
// Load flats
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
IEnumerable < ImageData > images = dr . LoadFlats ( cachedparsers ) ;
2009-04-19 18:07:22 +00:00
if ( images ! = null )
{
// Go for all flats
foreach ( ImageData img in images )
{
// Add or replace in flats list
list . Remove ( img . LongName ) ;
list . Add ( img . LongName , img ) ;
counter + + ;
2014-12-03 09:06:05 +00:00
//mxd. Also add as short name when texture name is longer than 8 chars
// Or remove when a wad image with short name overrides previously added
// resource image with long name
2015-12-28 15:01:53 +00:00
if ( img . HasLongName )
2014-12-03 09:06:05 +00:00
{
long longshortname = Lump . MakeLongName ( Path . GetFileNameWithoutExtension ( img . Name ) , false ) ;
nametranslation . Remove ( longshortname ) ;
nametranslation . Add ( longshortname , img . LongName ) ;
}
else if ( img is FlatImage & & nametranslation . ContainsKey ( img . LongName ) )
{
nametranslation . Remove ( img . LongName ) ;
}
2009-04-19 18:07:22 +00:00
// Add to preview manager
previews . AddImage ( img ) ;
}
}
}
// Output info
return counter ;
}
// This returns a specific flat stream
2014-11-25 11:52:01 +00:00
internal Stream GetFlatData ( string pname , bool longname )
2009-04-19 18:07:22 +00:00
{
// Go for all opened containers
for ( int i = containers . Count - 1 ; i > = 0 ; i - - )
{
// This contain provides this flat?
2015-12-28 15:01:53 +00:00
Stream flat = containers [ i ] . GetFlatData ( pname , longname ) ;
2009-04-19 18:07:22 +00:00
if ( flat ! = null ) return flat ;
}
// No such patch found
return null ;
}
2010-08-12 09:01:22 +00:00
// This checks if a flat is known
public bool GetFlatExists ( string name )
{
2015-01-16 13:14:57 +00:00
return GetFlatExists ( Lump . MakeLongName ( name ) ) ; //mxd
2010-08-12 09:01:22 +00:00
}
// This checks if a flat is known
public bool GetFlatExists ( long longname )
{
2014-12-03 09:06:05 +00:00
return flats . ContainsKey ( longname ) | | flatnamesshorttofull . ContainsKey ( longname ) ;
2010-08-12 09:01:22 +00:00
}
2009-04-19 18:07:22 +00:00
// This returns an image by string
public ImageData GetFlatImage ( string name )
{
// Get the long name
long longname = Lump . MakeLongName ( name ) ;
return GetFlatImage ( longname ) ;
}
// This returns an image by long
public ImageData GetFlatImage ( long longname )
{
2013-12-02 15:02:01 +00:00
// Does this flat exist?
2015-01-23 21:51:11 +00:00
if ( flats . ContainsKey ( longname ) & & flats [ longname ] is HighResImage ) return flats [ longname ] ; //TEXTURES flats should still override regular ones...
2014-12-03 09:06:05 +00:00
if ( flatnamesshorttofull . ContainsKey ( longname ) ) return flats [ flatnamesshorttofull [ longname ] ] ; //mxd
2013-12-02 15:02:01 +00:00
if ( flats . ContainsKey ( longname ) ) return flats [ longname ] ;
2013-12-03 10:50:33 +00:00
2013-07-29 08:50:50 +00:00
// Return null image
2014-01-13 08:06:56 +00:00
return unknownimage ; //mxd
2009-04-19 18:07:22 +00:00
}
2010-08-14 09:30:54 +00:00
// This returns an image by long and doesn't check if it exists
2015-01-23 21:51:11 +00:00
/ * public ImageData GetFlatImageKnown ( long longname )
2010-08-14 09:30:54 +00:00
{
// Return flat
2014-12-03 09:06:05 +00:00
return flatnamesshorttofull . ContainsKey ( longname ) ? flats [ flatnamesshorttofull [ longname ] ] : flats [ longname ] ; //mxd
2015-01-23 21:51:11 +00:00
} * /
2014-11-25 11:52:01 +00:00
//mxd. Gets full flat name by short flat name
public string GetFullFlatName ( string name )
{
if ( Path . GetFileNameWithoutExtension ( name ) = = name & & name . Length > CLASIC_IMAGE_NAME_LENGTH )
name = name . Substring ( 0 , CLASIC_IMAGE_NAME_LENGTH ) ;
long hash = MurmurHash2 . Hash ( name . ToUpperInvariant ( ) ) ;
2014-12-03 09:06:05 +00:00
2015-01-23 21:51:11 +00:00
if ( flats . ContainsKey ( hash ) & & flats [ hash ] is HighResImage ) return flats [ hash ] . Name ; //TEXTURES flats should still override regular ones...
2014-11-25 11:52:01 +00:00
if ( flatnamesshorttofull . ContainsKey ( hash ) ) return flats [ flatnamesshorttofull [ hash ] ] . Name ;
2014-12-03 09:06:05 +00:00
if ( flats . ContainsKey ( hash ) ) return flats [ hash ] . Name ;
2014-11-25 11:52:01 +00:00
return name ;
}
2014-12-03 09:06:05 +00:00
//mxd
internal long GetFullLongFlatName ( long hash )
{
2015-01-23 21:51:11 +00:00
if ( flats . ContainsKey ( hash ) & & flats [ hash ] is HighResImage ) return hash ; //TEXTURES flats should still override regular ones...
2014-12-03 09:06:05 +00:00
return ( General . Map . Config . UseLongTextureNames & & flatnamesshorttofull . ContainsKey ( hash ) ? flatnamesshorttofull [ hash ] : hash ) ;
}
2009-04-19 18:07:22 +00:00
#endregion
#region = = = = = = = = = = = = = = = = = = Sprites
2010-08-18 09:07:54 +00:00
// This loads the hard defined sprites (not all the lumps, we do that on a need-to-know basis, see LoadThingSprites)
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
private int LoadSprites ( Dictionary < string , TexturesParser > cachedparsers )
2010-08-18 09:07:54 +00:00
{
int counter = 0 ;
// Load all defined sprites. Note that we do not use all sprites,
// so we don't add them for previews just yet.
foreach ( DataReader dr in containers )
{
// Load sprites
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
IEnumerable < ImageData > images = dr . LoadSprites ( cachedparsers ) ;
2010-08-18 09:07:54 +00:00
if ( images ! = null )
{
// Add or replace in sprites list
foreach ( ImageData img in images )
{
sprites [ img . LongName ] = img ;
counter + + ;
}
}
}
// Output info
return counter ;
}
// This loads the sprites that we really need for things
private int LoadThingSprites ( )
2009-04-19 18:07:22 +00:00
{
// Go for all things
foreach ( ThingTypeInfo ti in General . Map . Data . ThingTypes )
{
2010-08-18 09:07:54 +00:00
// Valid sprite name?
2014-11-25 11:52:01 +00:00
if ( ti . Sprite . Length = = 0 | | ti . Sprite . Length > CLASIC_IMAGE_NAME_LENGTH ) continue ; //mxd
2010-08-18 09:07:54 +00:00
2014-01-03 10:33:45 +00:00
ImageData image = null ;
// Sprite not in our collection yet?
if ( ! sprites . ContainsKey ( ti . SpriteLongName ) )
{
// Find sprite data
Stream spritedata = GetSpriteData ( ti . Sprite ) ;
if ( spritedata ! = null )
2010-08-18 09:07:54 +00:00
{
2014-01-03 10:33:45 +00:00
// Make new sprite image
image = new SpriteImage ( ti . Sprite ) ;
// Add to collection
sprites . Add ( ti . SpriteLongName , image ) ;
}
2014-12-03 09:06:05 +00:00
else //mxd
{
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
General . ErrorLogger . Add ( ErrorType . Error , "Missing sprite lump \"" + ti . Sprite + "\". Forgot to include required resources?" ) ;
2010-08-18 09:07:54 +00:00
}
2014-01-03 10:33:45 +00:00
}
else
{
image = sprites [ ti . SpriteLongName ] ;
2009-04-19 18:07:22 +00:00
}
2014-01-03 10:33:45 +00:00
// Add to preview manager
if ( image ! = null ) previews . AddImage ( image ) ;
2009-04-19 18:07:22 +00:00
}
2010-08-18 09:07:54 +00:00
2009-04-19 18:07:22 +00:00
// Output info
return sprites . Count ;
}
2010-08-18 09:07:54 +00:00
2009-04-19 18:07:22 +00:00
// This returns a specific patch stream
internal Stream GetSpriteData ( string pname )
{
if ( ! string . IsNullOrEmpty ( pname ) )
{
// Go for all opened containers
for ( int i = containers . Count - 1 ; i > = 0 ; i - - )
{
// This contain provides this patch?
Stream spritedata = containers [ i ] . GetSpriteData ( pname ) ;
if ( spritedata ! = null ) return spritedata ;
}
}
// No such patch found
return null ;
}
// This tests if a given sprite can be found
internal bool GetSpriteExists ( string pname )
{
if ( ! string . IsNullOrEmpty ( pname ) )
{
2010-08-18 09:07:54 +00:00
long longname = Lump . MakeLongName ( pname ) ;
2015-01-23 21:51:11 +00:00
if ( sprites . ContainsKey ( longname ) ) return true ;
2010-08-18 09:07:54 +00:00
2009-04-19 18:07:22 +00:00
// Go for all opened containers
for ( int i = containers . Count - 1 ; i > = 0 ; i - - )
{
// This contain provides this patch?
if ( containers [ i ] . GetSpriteExists ( pname ) ) return true ;
}
}
// No such patch found
return false ;
}
// This loads the internal sprites
private void LoadInternalSprites ( )
{
// Add sprite icon files from directory
string [ ] files = Directory . GetFiles ( General . SpritesPath , "*.png" , SearchOption . TopDirectoryOnly ) ;
foreach ( string spritefile in files )
{
2014-11-25 11:52:01 +00:00
ImageData img = new FileImage ( Path . GetFileNameWithoutExtension ( spritefile ) . ToLowerInvariant ( ) , spritefile ) ;
2009-04-19 18:07:22 +00:00
img . LoadImage ( ) ;
2010-08-11 20:32:14 +00:00
img . AllowUnload = false ;
2009-04-19 18:07:22 +00:00
internalsprites . Add ( img . Name , img ) ;
}
// Add some internal resources
if ( ! internalsprites . ContainsKey ( "nothing" ) )
{
2009-08-02 18:21:53 +00:00
ImageData img = new ResourceImage ( "CodeImp.DoomBuilder.Resources.Nothing.png" ) ;
2009-04-19 18:07:22 +00:00
img . LoadImage ( ) ;
2010-08-11 20:32:14 +00:00
img . AllowUnload = false ;
2009-04-19 18:07:22 +00:00
internalsprites . Add ( "nothing" , img ) ;
}
if ( ! internalsprites . ContainsKey ( "unknownthing" ) )
{
2009-08-02 18:21:53 +00:00
ImageData img = new ResourceImage ( "CodeImp.DoomBuilder.Resources.UnknownThing.png" ) ;
2009-04-19 18:07:22 +00:00
img . LoadImage ( ) ;
2010-08-11 20:32:14 +00:00
img . AllowUnload = false ;
2009-04-19 18:07:22 +00:00
internalsprites . Add ( "unknownthing" , img ) ;
2013-08-21 10:45:54 +00:00
}
//mxd
2014-05-19 13:33:38 +00:00
if ( ! internalsprites . ContainsKey ( "missingthing" ) )
{
2013-08-21 10:45:54 +00:00
ImageData img = new ResourceImage ( "CodeImp.DoomBuilder.Resources.MissingThing.png" ) ;
img . LoadImage ( ) ;
img . AllowUnload = false ;
internalsprites . Add ( "missingthing" , img ) ;
2009-04-19 18:07:22 +00:00
}
}
2013-08-21 10:45:54 +00:00
// This returns an image by name
2009-04-19 18:07:22 +00:00
public ImageData GetSpriteImage ( string name )
{
// Is this referring to an internal sprite image?
if ( ( name . Length > INTERNAL_PREFIX . Length ) & & name . ToLowerInvariant ( ) . StartsWith ( INTERNAL_PREFIX ) )
{
// Get the internal sprite
string internalname = name . Substring ( INTERNAL_PREFIX . Length ) . ToLowerInvariant ( ) ;
if ( internalsprites . ContainsKey ( internalname ) )
return internalsprites [ internalname ] ;
2013-08-21 10:45:54 +00:00
return internalsprites [ "unknownthing" ] ; //mxd
2009-04-19 18:07:22 +00:00
}
else
{
// Get the long name
long longname = Lump . MakeLongName ( name ) ;
// Sprite already loaded?
if ( sprites . ContainsKey ( longname ) )
{
// Return exiting sprite
return sprites [ longname ] ;
}
else
{
Stream spritedata = null ;
// Go for all opened containers
for ( int i = containers . Count - 1 ; i > = 0 ; i - - )
{
2013-08-21 10:45:54 +00:00
// This container provides this sprite?
2009-04-19 18:07:22 +00:00
spritedata = containers [ i ] . GetSpriteData ( name ) ;
if ( spritedata ! = null ) break ;
}
// Found anything?
if ( spritedata ! = null )
{
// Make new sprite image
SpriteImage image = new SpriteImage ( name ) ;
// Add to collection
sprites . Add ( longname , image ) ;
// Return result
return image ;
}
2013-08-21 10:45:54 +00:00
else //mxd
2009-04-19 18:07:22 +00:00
{
2013-08-21 10:45:54 +00:00
ImageData img = string . IsNullOrEmpty ( name ) ? internalsprites [ "unknownthing" ] : internalsprites [ "missingthing" ] ;
// Add to collection
sprites . Add ( longname , img ) ;
2013-09-03 09:34:28 +00:00
// Return image
2013-08-21 10:45:54 +00:00
return img ;
2009-04-19 18:07:22 +00:00
}
}
}
}
#endregion
#region = = = = = = = = = = = = = = = = = = Things
// This loads the things from Decorate
2015-04-14 11:33:57 +00:00
private int LoadDecorateThings ( Dictionary < int , string > spawnnumsoverride , Dictionary < int , string > doomednumsoverride )
2009-04-19 18:07:22 +00:00
{
int counter = 0 ;
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
char [ ] catsplitter = { Path . AltDirectorySeparatorChar } ; //mxd
2009-04-19 18:07:22 +00:00
2009-08-15 08:41:43 +00:00
// Create new parser
2015-12-17 10:07:28 +00:00
decorate = new DecorateParser { OnInclude = LoadDecorateFromLocation } ;
2009-04-19 18:07:22 +00:00
// Only load these when the game configuration supports the use of decorate
if ( ! string . IsNullOrEmpty ( General . Map . Config . DecorateGames ) )
{
// Go for all opened containers
foreach ( DataReader dr in containers )
{
// Load Decorate info cumulatively (the last Decorate is added to the previous)
// I'm not sure if this is the right thing to do though.
currentreader = dr ;
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
IEnumerable < TextResourceData > decostreams = dr . GetDecorateData ( "DECORATE" ) ;
foreach ( TextResourceData data in decostreams )
2009-04-19 18:07:22 +00:00
{
// Parse the data
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
data . Stream . Seek ( 0 , SeekOrigin . Begin ) ;
decorate . Parse ( data , true ) ;
2009-04-19 18:07:22 +00:00
2015-12-17 10:07:28 +00:00
//mxd. DECORATE lumps are interdepandable. Can't carry on...
2009-08-15 08:41:43 +00:00
if ( decorate . HasError )
2009-04-19 18:07:22 +00:00
{
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
decorate . LogError ( ) ;
currentreader = null ;
2015-12-17 10:07:28 +00:00
return counter ;
2009-04-19 18:07:22 +00:00
}
}
}
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
//mxd. Add to text resources collection
textresources [ decorate . ScriptType ] = new HashSet < TextResource > ( decorate . TextResources . Values ) ;
2009-04-19 18:07:22 +00:00
currentreader = null ;
2009-08-15 08:41:43 +00:00
if ( ! decorate . HasError )
2009-04-19 18:07:22 +00:00
{
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
//mxd. Create DamageTypes list
// Combine damage types from config and decorate
HashSet < string > dtset = new HashSet < string > ( StringComparer . OrdinalIgnoreCase ) ;
dtset . UnionWith ( General . Map . Config . DamageTypes ) ;
dtset . UnionWith ( decorate . DamageTypes ) ;
// Sort values
List < string > dtypes = new List < string > ( dtset ) ;
dtypes . Sort ( ) ;
// Apply to collection
damagetypes = new string [ dtypes . Count ] ;
dtypes . CopyTo ( damagetypes ) ;
2015-04-14 11:33:57 +00:00
// Step 1. Go for all actors in the decorate to make things or update things
2009-08-15 08:41:43 +00:00
foreach ( ActorStructure actor in decorate . Actors )
2009-04-19 18:07:22 +00:00
{
// Check if we want to add this actor
if ( actor . DoomEdNum > 0 )
{
2015-06-08 14:37:20 +00:00
string catname = ZDTextParser . StripQuotes ( actor . GetPropertyAllValues ( "$category" ) ) ;
2015-06-01 21:46:28 +00:00
string [ ] catnames ; //mxd
if ( string . IsNullOrEmpty ( catname . Trim ( ) ) )
catnames = new [ ] { "decorate" } ;
else
catnames = catname . Split ( catsplitter , StringSplitOptions . RemoveEmptyEntries ) ; //mxd
2009-04-19 18:07:22 +00:00
// Check if we can find this thing in our existing collection
if ( thingtypes . ContainsKey ( actor . DoomEdNum ) )
{
// Update the thing
thingtypes [ actor . DoomEdNum ] . ModifyByDecorateActor ( actor ) ;
}
else
{
// Find the category to put the actor in
2015-06-01 21:46:28 +00:00
ThingCategory cat = GetThingCategory ( null , thingcategories , catnames ) ; //mxd
2009-04-19 18:07:22 +00:00
// Add new thing
ThingTypeInfo t = new ThingTypeInfo ( cat , actor ) ;
cat . AddThing ( t ) ;
thingtypes . Add ( t . Index , t ) ;
}
// Count
counter + + ;
2015-04-14 11:33:57 +00:00
}
}
//mxd. Step 2. Apply DoomEdNum MAPINFO overrides, remove actors disabled in MAPINFO
if ( doomednumsoverride . Count > 0 )
{
List < int > toremove = new List < int > ( ) ;
Dictionary < string , ThingTypeInfo > thingtypesbyclass = new Dictionary < string , ThingTypeInfo > ( ) ;
2015-12-28 15:01:53 +00:00
foreach ( KeyValuePair < int , ThingTypeInfo > group in thingtypes )
2015-04-14 11:33:57 +00:00
{
if ( string . IsNullOrEmpty ( group . Value . ClassName ) ) continue ;
thingtypesbyclass [ group . Value . ClassName . ToLowerInvariant ( ) ] = group . Value ;
}
foreach ( KeyValuePair < int , string > group in doomednumsoverride )
{
// Remove thing from the list?
if ( group . Value = = "none" )
{
toremove . Add ( group . Key ) ;
continue ;
}
// Skip if already added.
if ( thingtypes . ContainsKey ( group . Key ) & & thingtypes [ group . Key ] . ClassName . ToLowerInvariant ( ) = = group . Value )
{
continue ;
}
// Try to find the actor...
ActorStructure actor = null ;
2015-04-29 08:36:10 +00:00
//... in ActorsByClass
if ( decorate . ActorsByClass . ContainsKey ( group . Value ) )
2015-04-14 11:33:57 +00:00
{
2015-04-29 08:36:10 +00:00
actor = decorate . ActorsByClass [ group . Value ] ;
}
// Try finding in ArchivedActors
else if ( decorate . AllActorsByClass . ContainsKey ( group . Value ) )
{
actor = decorate . AllActorsByClass [ group . Value ] ;
2015-04-14 11:33:57 +00:00
}
if ( actor ! = null )
{
// Find the category to put the actor in
2015-06-08 14:37:20 +00:00
string catname = ZDTextParser . StripQuotes ( actor . GetPropertyAllValues ( "$category" ) ) ;
2015-06-01 21:46:28 +00:00
string [ ] catnames ; //mxd
if ( string . IsNullOrEmpty ( catname . Trim ( ) ) )
catnames = new [ ] { "decorate" } ;
else
catnames = catname . Split ( catsplitter , StringSplitOptions . RemoveEmptyEntries ) ; //mxd
ThingCategory cat = GetThingCategory ( null , thingcategories , catnames ) ; //mxd
2015-04-14 11:33:57 +00:00
// Add a new ThingTypeInfo, replacing already existing one if necessary
2015-04-29 08:36:10 +00:00
ThingTypeInfo info = new ThingTypeInfo ( cat , actor , group . Key ) ;
2015-04-14 11:33:57 +00:00
thingtypes [ group . Key ] = info ;
2015-04-29 08:36:10 +00:00
cat . AddThing ( info ) ;
2015-04-14 11:33:57 +00:00
}
// Check thingtypes...
else if ( thingtypesbyclass . ContainsKey ( group . Value ) )
{
ThingTypeInfo t = new ThingTypeInfo ( group . Key , thingtypesbyclass [ group . Value ] ) ;
// Add new thing, replacing already existing one if necessary
t . Category . AddThing ( t ) ;
thingtypes [ group . Key ] = t ;
}
// Loudly give up...
else
{
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
General . ErrorLogger . Add ( ErrorType . Warning , "Failed to apply MAPINFO DoomEdNum override \"" + group . Key + " = " + group . Value + "\": failed to find corresponding actor class..." ) ;
2015-04-14 11:33:57 +00:00
}
}
// Remove items
foreach ( int id in toremove )
{
if ( thingtypes . ContainsKey ( id ) )
{
thingtypes [ id ] . Category . RemoveThing ( thingtypes [ id ] ) ;
thingtypes . Remove ( id ) ;
}
}
}
//mxd. Step 3. Gather DECORATE SpawnIDs
Dictionary < int , EnumItem > configspawnnums = new Dictionary < int , EnumItem > ( ) ;
// Update or create the main enums list
if ( General . Map . Config . Enums . ContainsKey ( "spawnthing" ) )
{
foreach ( EnumItem item in General . Map . Config . Enums [ "spawnthing" ] )
configspawnnums . Add ( item . GetIntValue ( ) , item ) ;
}
bool spawnidschanged = false ;
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
foreach ( ActorStructure actor in decorate . Actors )
2015-04-14 11:33:57 +00:00
{
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
int spawnid = actor . GetPropertyValueInt ( "spawnid" , 0 ) ;
if ( spawnid ! = 0 )
2015-04-14 11:33:57 +00:00
{
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
configspawnnums [ spawnid ] = new EnumItem ( spawnid . ToString ( ) , ( actor . HasPropertyWithValue ( "$title" ) ? actor . GetPropertyAllValues ( "$title" ) : actor . ClassName ) ) ;
spawnidschanged = true ;
2015-04-14 11:33:57 +00:00
}
}
//mxd. Step 4. Update SpawnNums using MAPINFO overrides
if ( spawnnumsoverride . Count > 0 )
{
// Modify by MAPINFO data
foreach ( KeyValuePair < int , string > group in spawnnumsoverride )
configspawnnums [ group . Key ] = new EnumItem ( group . Key . ToString ( ) , ( thingtypes . ContainsKey ( group . Key ) ? thingtypes [ group . Key ] . Title : group . Value ) ) ;
spawnidschanged = true ;
}
if ( spawnidschanged )
{
// Update the main collection
EnumList newenums = new EnumList ( ) ;
newenums . AddRange ( configspawnnums . Values ) ;
newenums . Sort ( ) ;
General . Map . Config . Enums [ "spawnthing" ] = newenums ;
// Update all ArgumentInfos...
2015-12-28 15:01:53 +00:00
foreach ( ThingTypeInfo info in thingtypes . Values )
2015-04-14 11:33:57 +00:00
{
foreach ( ArgumentInfo ai in info . Args )
if ( ai . Enum . Name = = "spawnthing" ) ai . Enum = newenums ;
}
2015-12-28 15:01:53 +00:00
foreach ( LinedefActionInfo info in General . Map . Config . LinedefActions . Values )
2015-04-14 11:33:57 +00:00
{
foreach ( ArgumentInfo ai in info . Args )
if ( ai . Enum . Name = = "spawnthing" ) ai . Enum = newenums ;
2009-04-19 18:07:22 +00:00
}
}
}
}
// Output info
return counter ;
}
2015-04-14 11:33:57 +00:00
//mxd
2015-06-01 21:46:28 +00:00
private static ThingCategory GetThingCategory ( ThingCategory parent , List < ThingCategory > categories , string [ ] catnames )
2015-04-14 11:33:57 +00:00
{
// Find the category to put the actor in
ThingCategory cat = null ;
2015-06-01 21:46:28 +00:00
string catname = catnames [ 0 ] . ToLowerInvariant ( ) . Trim ( ) ;
if ( string . IsNullOrEmpty ( catname ) ) catname = "decorate" ;
// First search by Title...
foreach ( ThingCategory c in categories )
2015-04-14 11:33:57 +00:00
{
if ( c . Title . ToLowerInvariant ( ) = = catname ) cat = c ;
}
2015-06-08 14:37:20 +00:00
// Make full name
if ( parent ! = null ) catname = parent . Name . ToLowerInvariant ( ) + "." + catname ;
2015-06-01 22:10:15 +00:00
//...then - by Name
2015-04-14 11:33:57 +00:00
if ( cat = = null )
{
2015-06-01 21:46:28 +00:00
foreach ( ThingCategory c in categories )
2015-04-14 11:33:57 +00:00
{
if ( c . Name . ToLowerInvariant ( ) = = catname ) cat = c ;
}
}
// Make the category if needed
2015-06-01 21:46:28 +00:00
if ( cat = = null )
{
string cattitle = catnames [ 0 ] . Trim ( ) ;
if ( string . IsNullOrEmpty ( cattitle ) ) cattitle = "Decorate" ;
2015-06-01 22:10:15 +00:00
cat = new ThingCategory ( parent , catname , cattitle ) ;
2015-06-01 21:46:28 +00:00
categories . Add ( cat ) ; // ^.^
}
// Still have subcategories?
if ( catnames . Length > 1 )
2015-04-14 11:33:57 +00:00
{
2015-06-01 21:46:28 +00:00
string [ ] remainingnames = new string [ catnames . Length - 1 ] ;
Array . Copy ( catnames , 1 , remainingnames , 0 , remainingnames . Length ) ;
return GetThingCategory ( cat , cat . Children , remainingnames ) ;
2015-04-14 11:33:57 +00:00
}
return cat ;
}
2009-04-19 18:07:22 +00:00
// This loads Decorate data from a specific file or lump name
private void LoadDecorateFromLocation ( DecorateParser parser , string location )
{
//General.WriteLogLine("Including DECORATE resource '" + location + "'...");
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
IEnumerable < TextResourceData > decostreams = currentreader . GetDecorateData ( location ) ;
foreach ( TextResourceData data in decostreams )
2009-04-19 18:07:22 +00:00
{
// Parse this data
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
parser . Parse ( data , false ) ;
2015-12-18 10:16:53 +00:00
//mxd. DECORATE lumps are interdepandable. Can't carry on...
if ( parser . HasError )
{
2016-02-01 22:04:00 +00:00
parser . LogError ( ) ;
2015-12-18 10:16:53 +00:00
return ;
}
2009-04-19 18:07:22 +00:00
}
}
// This gets thing information by index
public ThingTypeInfo GetThingInfo ( int thingtype )
{
// Index in config?
if ( thingtypes . ContainsKey ( thingtype ) )
{
// Return from config
return thingtypes [ thingtype ] ;
}
2014-02-21 15:24:54 +00:00
// Create unknown thing info
return new ThingTypeInfo ( thingtype ) ;
2009-04-19 18:07:22 +00:00
}
// This gets thing information by index
// Returns null when thing type info could not be found
public ThingTypeInfo GetThingInfoEx ( int thingtype )
{
// Index in config?
if ( thingtypes . ContainsKey ( thingtype ) )
{
// Return from config
return thingtypes [ thingtype ] ;
}
2014-02-21 15:24:54 +00:00
// No such thing type known
return null ;
2009-04-19 18:07:22 +00:00
}
#endregion
2014-01-03 10:33:45 +00:00
#region = = = = = = = = = = = = = = = = = = mxd . Modeldef , Voxeldef , Gldefs , Mapinfo
2012-05-21 23:51:32 +00:00
2013-09-11 09:47:53 +00:00
//mxd. This creates <Actor Class, Thing.Type> dictionary. Should be called after all DECORATE actors are parsed
2015-12-21 14:17:47 +00:00
private Dictionary < string , int > CreateActorsByClassList ( )
2014-12-03 23:15:26 +00:00
{
2016-01-11 13:00:52 +00:00
Dictionary < string , int > actors = new Dictionary < string , int > ( StringComparer . OrdinalIgnoreCase ) ;
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 ( string . IsNullOrEmpty ( General . Map . Config . DecorateGames ) ) return actors ;
2012-05-21 23:51:32 +00:00
2013-09-11 09:47:53 +00:00
//read our new shiny ClassNames for default game things
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
foreach ( KeyValuePair < int , ThingTypeInfo > ti in thingtypes )
2014-12-03 23:15:26 +00:00
{
2015-04-14 11:33:57 +00:00
if ( ! string . IsNullOrEmpty ( ti . Value . ClassName ) )
{
2016-01-11 13:00:52 +00:00
if ( actors . ContainsKey ( ti . Value . ClassName ) & & actors [ ti . Value . ClassName ] ! = ti . Key )
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
General . ErrorLogger . Add ( ErrorType . Warning , "Actor \"" + ti . Value . ClassName + "\" has several editor numbers! Only the last one (" + ti . Key + ") will be used." ) ;
2016-01-11 13:00:52 +00:00
actors [ ti . Value . ClassName ] = ti . Key ;
2015-04-14 11:33:57 +00:00
}
2013-09-11 09:47:53 +00:00
}
2012-06-01 10:17:47 +00:00
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 ( actors . Count = = 0 )
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
General . ErrorLogger . Add ( ErrorType . Warning , "Unable to find any DECORATE actor definitions!" ) ;
2013-09-16 14:07:12 +00:00
2013-09-11 09:47:53 +00:00
return actors ;
}
2012-06-01 10:17:47 +00:00
2013-09-11 09:47:53 +00:00
//mxd
2014-12-03 23:15:26 +00:00
public void ReloadModeldef ( )
{
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 ( modeldefentries ! = null )
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
foreach ( KeyValuePair < int , ModelData > group in modeldefentries ) group . Value . Dispose ( ) ;
2012-08-05 19:18:05 +00:00
2015-12-18 10:16:53 +00:00
// Bail out when not supported by current game configuration
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 ( string . IsNullOrEmpty ( General . Map . Config . DecorateGames ) ) return ;
2013-09-11 09:47:53 +00:00
General . MainWindow . DisplayStatus ( StatusType . Busy , "Reloading model definitions..." ) ;
2014-12-03 23:15:26 +00:00
LoadModeldefs ( CreateActorsByClassList ( ) ) ;
2013-07-29 08:50:50 +00:00
2014-03-03 13:40:29 +00:00
General . MainWindow . DisplayStatus ( StatusType . Busy , "Reloading voxel definitions..." ) ;
2014-12-03 23:15:26 +00:00
LoadVoxels ( ) ;
2014-03-03 13:40:29 +00:00
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
foreach ( Thing t in General . Map . Map . Things ) t . UpdateCache ( ) ;
2012-06-01 10:17:47 +00:00
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
// Rebuild geometry if in Visual mode
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 ( General . Editing . Mode ! = null & & General . Editing . Mode . GetType ( ) . Name = = "BaseVisualMode" )
2014-12-03 23:15:26 +00:00
{
2013-09-11 09:47:53 +00:00
General . Editing . Mode . OnReloadResources ( ) ;
}
General . MainWindow . DisplayReady ( ) ;
}
//mxd
2014-12-03 23:15:26 +00:00
public void ReloadGldefs ( )
{
2015-12-18 10:16:53 +00:00
// Bail out when not supported by current game configuration
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 ( string . IsNullOrEmpty ( General . Map . Config . DecorateGames ) ) return ;
2013-09-11 09:47:53 +00:00
General . MainWindow . DisplayStatus ( StatusType . Busy , "Reloading GLDEFS..." ) ;
2014-03-03 13:40:29 +00:00
2014-12-03 23:15:26 +00:00
try
{
LoadGldefs ( CreateActorsByClassList ( ) ) ;
}
catch ( ArgumentNullException )
{
2014-03-03 13:40:29 +00:00
MessageBox . Show ( "GLDEFS reload failed. Try using 'Reload Resources' instead.\nCheck 'Errors and Warnings' window for more details." ) ;
General . MainWindow . DisplayReady ( ) ;
return ;
}
2013-09-11 09:47:53 +00:00
2016-01-14 22:15:54 +00:00
// Rebuild skybox texture
SetupSkybox ( ) ;
2016-01-11 13:00:52 +00:00
// Rebuild geometry if in Visual mode
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 ( General . Editing . Mode ! = null & & General . Editing . Mode . GetType ( ) . Name = = "BaseVisualMode" )
2014-12-03 23:15:26 +00:00
{
2013-09-11 09:47:53 +00:00
General . Editing . Mode . OnReloadResources ( ) ;
}
General . MainWindow . DisplayReady ( ) ;
}
//mxd. This parses modeldefs. Should be called after all DECORATE actors are parsed and actorsByClass dictionary created
2015-12-21 14:17:47 +00:00
private void LoadModeldefs ( Dictionary < string , int > actorsbyclass )
2014-12-03 23:15:26 +00:00
{
2013-09-11 09:47:53 +00:00
//if no actors defined in DECORATE or game config...
2015-12-21 14:17:47 +00:00
if ( actorsbyclass . Count = = 0 ) return ;
2013-09-11 09:47:53 +00:00
2015-12-21 14:17:47 +00:00
Dictionary < string , ModelData > modeldefentriesbyname = new Dictionary < string , ModelData > ( StringComparer . Ordinal ) ;
ModeldefParser parser = new ModeldefParser ( actorsbyclass ) ;
2013-09-11 09:47:53 +00:00
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
foreach ( DataReader dr in containers )
2014-12-03 23:15:26 +00:00
{
2013-09-11 09:47:53 +00:00
currentreader = dr ;
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
IEnumerable < TextResourceData > streams = dr . GetModeldefData ( ) ;
foreach ( TextResourceData data in streams )
2014-12-03 23:15:26 +00:00
{
2013-09-11 09:47:53 +00:00
// Parse the data
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
if ( parser . Parse ( data , true ) )
2014-12-03 23:15:26 +00:00
{
foreach ( KeyValuePair < string , ModelData > g in parser . Entries )
{
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
if ( modeldefentriesbyname . ContainsKey ( g . Key ) )
General . ErrorLogger . Add ( ErrorType . Warning , "Model definition for actor \"" + g . Key + "\" is double defined in \"" + Path . Combine ( data . Source . Location . GetShortName ( ) , data . Filename ) + "\"" ) ;
2015-12-21 14:17:47 +00:00
modeldefentriesbyname [ g . Key ] = g . Value ;
2013-09-11 09:47:53 +00:00
}
}
2015-12-17 10:07:28 +00:00
// Modeldefs are independable, so parsing fail in one file should not affect the others
2015-12-18 10:16:53 +00:00
if ( parser . HasError ) parser . LogError ( ) ;
2013-09-11 09:47:53 +00:00
}
}
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
//mxd. Add to text resources collection
textresources [ parser . ScriptType ] = new HashSet < TextResource > ( parser . TextResources . Values ) ;
2013-09-11 09:47:53 +00:00
currentreader = null ;
2015-12-21 14:17:47 +00:00
foreach ( KeyValuePair < string , ModelData > e in modeldefentriesbyname )
2014-12-03 23:15:26 +00:00
{
2015-12-21 14:17:47 +00:00
if ( actorsbyclass . ContainsKey ( e . Key ) )
modeldefentries [ actorsbyclass [ e . Key ] ] = modeldefentriesbyname [ e . Key ] ;
2015-04-14 11:33:57 +00:00
else if ( ! decorate . ActorsByClass . ContainsKey ( e . Key ) )
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
General . ErrorLogger . Add ( ErrorType . Warning , "MODELDEF model \"" + e . Key + "\" doesn't match any Decorate actor class" ) ;
2013-09-11 09:47:53 +00:00
}
}
2012-06-01 10:17:47 +00:00
2014-01-03 10:33:45 +00:00
//mxd
2014-12-03 23:15:26 +00:00
private void LoadVoxels ( )
{
2015-12-18 10:16:53 +00:00
// Bail out when not supported by current game configuration
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 ( string . IsNullOrEmpty ( General . Map . Config . DecorateGames ) ) return ;
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
// Get names of all voxel models, which can be used "as is"
HashSet < string > voxelnames = new HashSet < string > ( StringComparer . OrdinalIgnoreCase ) ;
2014-01-03 10:33:45 +00:00
2014-12-03 23:15:26 +00:00
foreach ( DataReader dr in containers )
{
2014-01-03 10:33:45 +00:00
currentreader = dr ;
2015-12-18 10:16:53 +00:00
IEnumerable < string > result = dr . GetVoxelNames ( ) ;
2014-01-03 10:33:45 +00:00
if ( result = = null ) continue ;
2014-12-03 23:15:26 +00:00
foreach ( string s in result )
{
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
if ( ! voxelnames . Contains ( s ) ) voxelnames . Add ( s ) ;
2014-01-03 10:33:45 +00:00
}
}
2014-02-26 14:11:06 +00:00
Dictionary < string , List < int > > sprites = new Dictionary < string , List < int > > ( StringComparer . Ordinal ) ;
2014-01-03 10:33:45 +00:00
// Go for all things
2014-12-03 23:15:26 +00:00
foreach ( ThingTypeInfo ti in thingtypes . Values )
{
2014-01-03 10:33:45 +00:00
// Valid sprite name?
2014-02-21 14:42:12 +00:00
string sprite ;
2014-01-03 10:33:45 +00:00
2014-12-03 23:15:26 +00:00
if ( ti . Sprite . Length = = 0 | | ti . Sprite . Length > CLASIC_IMAGE_NAME_LENGTH )
{
2014-01-03 10:33:45 +00:00
if ( ti . Actor = = null ) continue ;
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
sprite = ti . Actor . FindSuitableVoxel ( voxelnames ) ;
2014-12-03 23:15:26 +00:00
}
else
{
2014-01-03 10:33:45 +00:00
sprite = ti . Sprite ;
}
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 ( string . IsNullOrEmpty ( sprite ) ) continue ;
2014-01-03 10:33:45 +00:00
if ( ! sprites . ContainsKey ( sprite ) ) sprites . Add ( sprite , new List < int > ( ) ) ;
sprites [ sprite ] . Add ( ti . Index ) ;
}
VoxeldefParser parser = new VoxeldefParser ( ) ;
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
HashSet < string > processed = new HashSet < string > ( StringComparer . OrdinalIgnoreCase ) ;
2014-01-03 10:33:45 +00:00
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
// Parse VOXLEDEF
2014-12-03 23:15:26 +00:00
foreach ( DataReader dr in containers )
{
2014-01-03 10:33:45 +00:00
currentreader = dr ;
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
IEnumerable < TextResourceData > streams = dr . GetVoxeldefData ( ) ;
foreach ( TextResourceData data in streams )
2014-12-03 23:15:26 +00:00
{
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
if ( parser . Parse ( data , true ) )
2014-12-03 23:15:26 +00:00
{
2015-12-17 10:07:28 +00:00
foreach ( KeyValuePair < string , ModelData > entry in parser . Entries )
2014-12-03 23:15:26 +00:00
{
2015-12-17 10:07:28 +00:00
foreach ( KeyValuePair < string , List < int > > sc in sprites )
2014-12-03 23:15:26 +00:00
{
2015-12-17 10:07:28 +00:00
if ( sc . Key . Contains ( entry . Key ) )
{
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
foreach ( int id in sc . Value )
modeldefentries [ id ] = entry . Value ;
processed . Add ( entry . Key ) ;
2015-12-17 10:07:28 +00:00
}
2014-01-03 10:33:45 +00:00
}
}
}
2015-12-17 10:07:28 +00:00
// Report errors?
2015-12-18 10:16:53 +00:00
if ( parser . HasError ) parser . LogError ( ) ;
2014-01-03 10:33:45 +00:00
}
}
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
//mxd. Add to text resources collection
textresources [ parser . ScriptType ] = new HashSet < TextResource > ( parser . TextResources . Values ) ;
2014-01-03 10:33:45 +00:00
currentreader = null ;
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
// Get voxel models
foreach ( string voxelname in voxelnames )
2014-12-03 23:15:26 +00:00
{
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
if ( processed . Contains ( voxelname ) ) continue ;
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
foreach ( KeyValuePair < string , List < int > > sc in sprites )
2014-12-03 23:15:26 +00:00
{
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
if ( sc . Key . Contains ( voxelname ) )
2014-12-03 23:15:26 +00:00
{
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
// It's a model without a definition, and it corresponds to a sprite we can display, so let's add it
2014-02-26 14:11:06 +00:00
ModelData data = new ModelData { IsVoxel = true } ;
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
data . ModelNames . Add ( voxelname ) ;
2014-01-03 10:33:45 +00:00
2015-04-14 11:33:57 +00:00
foreach ( int id in sprites [ sc . Key ] ) modeldefentries [ id ] = data ;
2014-01-03 10:33:45 +00:00
}
}
}
}
2015-12-21 14:17:47 +00:00
//mxd. This parses gldefs. Should be called after all DECORATE actors are parsed
private void LoadGldefs ( Dictionary < string , int > actorsbyclass )
2014-12-03 23:15:26 +00:00
{
2016-01-11 13:00:52 +00:00
// Skip if no actors defined in DECORATE or game config...
2015-12-21 14:17:47 +00:00
if ( actorsbyclass . Count = = 0 ) return ;
2013-09-11 09:47:53 +00:00
2015-04-14 11:33:57 +00:00
GldefsParser parser = new GldefsParser { OnInclude = ParseFromLocation } ;
2013-09-11 09:47:53 +00:00
2015-12-17 10:07:28 +00:00
// Load gldefs from resources
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
foreach ( DataReader dr in containers )
2014-12-03 23:15:26 +00:00
{
2013-09-11 09:47:53 +00:00
currentreader = dr ;
2015-01-20 12:20:35 +00:00
parser . ClearIncludesList ( ) ;
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
IEnumerable < TextResourceData > streams = dr . GetGldefsData ( General . Map . Config . GameType ) ;
2013-09-11 09:47:53 +00:00
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
foreach ( TextResourceData data in streams )
2015-12-17 10:07:28 +00:00
{
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
parser . Parse ( data , false ) ;
2015-12-17 10:07:28 +00:00
// Gldefs can be interdependable. Can't carry on
if ( parser . HasError )
{
parser . LogError ( ) ;
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
currentreader = null ;
2015-12-17 10:07:28 +00:00
return ;
}
}
2013-09-11 09:47:53 +00:00
}
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
//mxd. Add to text resources collection
textresources [ parser . ScriptType ] = new HashSet < TextResource > ( parser . TextResources . Values ) ;
currentreader = null ;
2016-01-11 13:00:52 +00:00
// Create Gldefs Entries dictionary
2015-12-21 14:17:47 +00:00
foreach ( KeyValuePair < string , string > e in parser . Objects ) //<ClassName, Light name>
2014-12-03 23:15:26 +00:00
{
2016-01-11 13:00:52 +00:00
// If we have decorate actor and light definition for given ClassName...
2015-12-21 14:17:47 +00:00
if ( actorsbyclass . ContainsKey ( e . Key ) & & parser . LightsByName . ContainsKey ( e . Value ) )
gldefsentries [ actorsbyclass [ e . Key ] ] = parser . LightsByName [ e . Value ] ;
2015-04-14 11:33:57 +00:00
else if ( ! decorate . AllActorsByClass . ContainsKey ( e . Key ) )
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
General . ErrorLogger . Add ( ErrorType . Warning , "GLDEFS object \"" + e . Key + "\" doesn't match any DECORATE actor class" ) ;
2013-09-11 09:47:53 +00:00
}
2015-04-14 11:33:57 +00:00
// Grab them glowy flats!
glowingflats = parser . GlowingFlats ;
2016-01-11 13:00:52 +00:00
// And skyboxes
skyboxes = parser . Skyboxes ;
2013-09-11 09:47:53 +00:00
}
2016-01-18 11:39:59 +00:00
//mxd. This updates mapinfo class only
internal void ReloadMapInfoPartial ( )
{
Dictionary < int , string > spawnnums , doomednums ;
LoadMapInfo ( out spawnnums , out doomednums ) ;
}
2013-09-11 09:47:53 +00:00
//mxd. This loads (Z)MAPINFO
2015-04-14 11:33:57 +00:00
private void LoadMapInfo ( out Dictionary < int , string > spawnnums , out Dictionary < int , string > doomednums )
2014-12-03 23:15:26 +00:00
{
2015-04-14 11:33:57 +00:00
MapinfoParser parser = new MapinfoParser { OnInclude = ParseFromLocation } ;
2016-01-11 13:00:52 +00:00
// Parse mapinfo
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
foreach ( DataReader dr in containers )
2014-12-03 23:15:26 +00:00
{
2013-09-11 09:47:53 +00:00
currentreader = dr ;
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
IEnumerable < TextResourceData > streams = dr . GetMapinfoData ( ) ;
2013-09-11 09:47:53 +00:00
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
foreach ( TextResourceData data in streams )
2014-12-03 23:15:26 +00:00
{
2013-09-11 09:47:53 +00:00
// Parse the data
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
parser . Parse ( data , General . Map . Options . LevelName , false ) ;
2015-12-17 10:07:28 +00:00
//MAPINFO lumps are interdependable. Can't carry on...
if ( parser . HasError )
{
parser . LogError ( ) ;
2016-01-11 13:00:52 +00:00
break ;
2015-12-17 10:07:28 +00:00
}
2013-09-11 09:47:53 +00:00
}
}
2016-01-11 13:00:52 +00:00
if ( ! parser . HasError )
{
// Store parsed data
spawnnums = parser . SpawnNums ;
doomednums = parser . DoomEdNums ;
mapinfo = parser . MapInfo ;
}
else
{
// No nulls allowed!
spawnnums = new Dictionary < int , string > ( ) ;
doomednums = new Dictionary < int , string > ( ) ;
mapinfo = new MapInfo ( ) ;
}
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
//mxd. Add to text resources collection
textresources [ parser . ScriptType ] = new HashSet < TextResource > ( parser . TextResources . Values ) ;
2013-09-11 09:47:53 +00:00
currentreader = null ;
}
2015-12-18 10:16:53 +00:00
private void ParseFromLocation ( ZDTextParser parser , string location , bool clearerrors )
2014-12-03 23:15:26 +00:00
{
2015-04-14 11:33:57 +00:00
if ( currentreader . IsSuspended ) throw new Exception ( "Data reader is suspended" ) ;
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
parser . Parse ( new TextResourceData ( currentreader , currentreader . LoadFile ( location ) , location , true ) , clearerrors ) ;
2013-09-11 09:47:53 +00:00
}
2015-01-25 23:22:42 +00:00
//mxd. This loads REVERBS
private void LoadReverbs ( )
{
reverbs . Clear ( ) ;
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-12-18 10:16:53 +00:00
// Bail out when not supported by current game configuration
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 ( string . IsNullOrEmpty ( General . Map . Config . DecorateGames ) ) return ;
ReverbsParser parser = new ReverbsParser ( ) ;
2015-01-25 23:22:42 +00:00
foreach ( DataReader dr in containers )
{
currentreader = dr ;
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
IEnumerable < TextResourceData > streams = dr . GetReverbsData ( ) ;
foreach ( TextResourceData data in streams )
2015-01-25 23:22:42 +00:00
{
// Parse the data
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
parser . Parse ( data , true ) ;
2015-12-17 10:07:28 +00:00
// Report errors?
2015-12-18 10:16:53 +00:00
if ( parser . HasError ) parser . LogError ( ) ;
2015-01-25 23:22:42 +00:00
}
}
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
//mxd. Add to text resources collection
textresources [ parser . ScriptType ] = new HashSet < TextResource > ( parser . TextResources . Values ) ;
2015-01-25 23:22:42 +00:00
currentreader = null ;
reverbs = parser . GetReverbs ( ) ;
}
2015-05-28 13:45:01 +00:00
//mxd. This loads SNDSEQ
private void LoadSndSeq ( )
{
2015-12-18 10:16:53 +00:00
// Bail out when not supported by current game configuration
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 ( string . IsNullOrEmpty ( General . Map . Config . DecorateGames ) ) return ;
SndSeqParser parser = new SndSeqParser ( ) ;
2015-05-28 13:45:01 +00:00
foreach ( DataReader dr in containers )
{
currentreader = dr ;
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
IEnumerable < TextResourceData > streams = dr . GetSndSeqData ( ) ;
2015-05-28 13:45:01 +00:00
// Parse the data
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
foreach ( TextResourceData data in streams )
2015-05-28 13:45:01 +00:00
{
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
parser . Parse ( data , true ) ;
2015-12-17 10:07:28 +00:00
// Report errors?
2015-12-18 10:16:53 +00:00
if ( parser . HasError ) parser . LogError ( ) ;
}
}
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
//mxd. Add to text resources collection
textresources [ parser . ScriptType ] = new HashSet < TextResource > ( parser . TextResources . Values ) ;
2015-12-18 10:16:53 +00:00
currentreader = null ;
soundsequences = parser . GetSoundSequences ( ) ;
}
//mxd. This loads cameratextures from ANIMDEFS
private void LoadAnimdefs ( )
{
// Bail out when not supported by current game configuration
if ( string . IsNullOrEmpty ( General . Map . Config . DecorateGames ) ) return ;
AnimdefsParser parser = new AnimdefsParser ( ) ;
foreach ( DataReader dr in containers )
{
currentreader = dr ;
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
IEnumerable < TextResourceData > streams = dr . GetAnimdefsData ( ) ;
2015-12-18 10:16:53 +00:00
// Parse the data
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
foreach ( TextResourceData data in streams )
2015-12-18 10:16:53 +00:00
{
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
parser . Parse ( data , true ) ;
2015-12-18 10:16:53 +00:00
// Report errors?
if ( parser . HasError ) parser . LogError ( ) ;
// Create images
foreach ( var g in parser . CameraTextures )
2015-12-17 10:07:28 +00:00
{
2015-12-18 10:16:53 +00:00
// Grab a local copy
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
CameraTextureData camtexdata = g . Value ;
2015-12-18 10:16:53 +00:00
// Apply texture size override?
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
if ( ! camtexdata . FitTexture )
2015-12-18 10:16:53 +00:00
{
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
long longname = Lump . MakeLongName ( camtexdata . Name ) ;
2015-12-18 10:16:53 +00:00
if ( textures . ContainsKey ( longname ) )
{
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
camtexdata . ScaleX = ( float ) textures [ longname ] . Width / camtexdata . Width ;
camtexdata . ScaleY = ( float ) textures [ longname ] . Height / camtexdata . Height ;
2015-12-18 10:16:53 +00:00
}
else if ( flats . ContainsKey ( longname ) )
{
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
camtexdata . ScaleX = ( float ) flats [ longname ] . Width / camtexdata . Width ;
camtexdata . ScaleY = ( float ) flats [ longname ] . Height / camtexdata . Height ;
2015-12-18 10:16:53 +00:00
}
}
// Create texture
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
CameraTextureImage camteximage = new CameraTextureImage ( camtexdata ) ;
2015-12-18 10:16:53 +00:00
// Add to flats and textures
texturenames . Add ( camteximage . Name ) ;
flatnames . Add ( camteximage . Name ) ;
//TODO: Do cameratextures override stuff like this?..
textures [ camteximage . LongName ] = camteximage ;
flats [ camteximage . LongName ] = camteximage ;
// Add to preview manager
previews . AddImage ( camteximage ) ;
// Add to container's texture set
currentreader . TextureSet . AddFlat ( camteximage ) ;
currentreader . TextureSet . AddTexture ( camteximage ) ;
2015-12-17 10:07:28 +00:00
}
2015-05-28 13:45:01 +00:00
}
}
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
//mxd. Add to text resources collection
textresources [ parser . ScriptType ] = new HashSet < TextResource > ( parser . TextResources . Values ) ;
currentreader = null ;
}
//mxd. This loads TERRAIN
private void LoadTerrain ( )
{
// Bail out when not supported by current game configuration
if ( string . IsNullOrEmpty ( General . Map . Config . DecorateGames ) ) return ;
TerrainParser parser = new TerrainParser ( ) ;
foreach ( DataReader dr in containers )
{
currentreader = dr ;
IEnumerable < TextResourceData > streams = dr . GetTerrainData ( ) ;
// Parse the data
foreach ( TextResourceData data in streams )
{
parser . Parse ( data , true ) ;
// Report errors?
if ( parser . HasError ) parser . LogError ( ) ;
}
}
// Add to text resources collection
textresources [ parser . ScriptType ] = new HashSet < TextResource > ( parser . TextResources . Values ) ;
2015-05-28 13:45:01 +00:00
currentreader = null ;
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
// Sort
List < string > names = new List < string > ( parser . TerrainNames ) ;
names . Sort ( ) ;
// Set as collection
terrainnames = names . ToArray ( ) ;
2015-05-28 13:45:01 +00:00
}
2013-09-11 09:47:53 +00:00
//mxd
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
internal TextResourceData LoadFile ( string name )
2014-12-03 23:15:26 +00:00
{
2015-12-21 14:17:47 +00:00
// Filesystem path?
if ( Path . IsPathRooted ( name ) )
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
{
if ( File . Exists ( name ) )
{
DataLocation location = new DataLocation { location = name , type = DataLocation . RESOURCE_DIRECTORY } ;
return new TextResourceData ( File . OpenRead ( name ) , location , name , false ) ;
}
2015-12-21 14:17:47 +00:00
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
return null ;
}
// Search in resources
for ( int i = containers . Count - 1 ; i > = 0 ; i - - )
{
if ( containers [ i ] . FileExists ( name ) )
return new TextResourceData ( containers [ i ] , containers [ i ] . LoadFile ( name ) , name , false ) ;
}
2015-12-21 14:17:47 +00:00
2013-09-11 09:47:53 +00:00
return null ;
}
#endregion
#region = = = = = = = = = = = = = = = = = = Tools
// This finds the first IWAD resource
2009-04-19 18:07:22 +00:00
// Returns false when not found
2012-06-01 19:53:14 +00:00
public bool FindFirstIWAD ( out DataLocation result )
2009-04-19 18:07:22 +00:00
{
// Go for all data containers
foreach ( DataReader dr in containers )
{
// Container is a WAD file?
if ( dr is WADReader )
{
// Check if it is an IWAD
WADReader wr = dr as WADReader ;
if ( wr . IsIWAD )
{
// Return location!
result = wr . Location ;
return true ;
}
}
}
// No IWAD found
result = new DataLocation ( ) ;
return false ;
}
// This signals the background thread to update the
// used-in-map status on all textures and flats
public void UpdateUsedTextures ( )
{
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
if ( General . Map . Config . MixTexturesFlats )
2009-04-19 18:07:22 +00:00
{
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
lock ( usedtextures )
{
usedtextures . Clear ( ) ;
2009-04-19 18:07:22 +00:00
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
// Go through the map to find the used textures
foreach ( Sidedef sd in General . Map . Map . Sidedefs )
{
// Add used textures to dictionary
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
if ( sd . LongHighTexture ! = MapSet . EmptyLongName ) usedtextures [ sd . LongHighTexture ] = true ;
if ( sd . LongMiddleTexture ! = MapSet . EmptyLongName ) usedtextures [ sd . LongMiddleTexture ] = true ;
if ( sd . LongLowTexture ! = MapSet . EmptyLongName ) usedtextures [ sd . LongLowTexture ] = true ;
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
}
// Go through the map to find the used flats
foreach ( Sector s in General . Map . Map . Sectors )
{
// Add used flats to dictionary
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
usedtextures [ s . LongFloorTexture ] = false ;
usedtextures [ s . LongCeilTexture ] = false ;
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
}
}
}
//mxd. Use separate collections
else
{
lock ( usedtextures )
2009-04-19 18:07:22 +00:00
{
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
usedtextures . Clear ( ) ;
// Go through the map to find the used textures
foreach ( Sidedef sd in General . Map . Map . Sidedefs )
{
// Add used textures to dictionary
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
if ( sd . LongHighTexture ! = MapSet . EmptyLongName ) usedtextures [ sd . LongHighTexture ] = true ;
if ( sd . LongMiddleTexture ! = MapSet . EmptyLongName ) usedtextures [ sd . LongMiddleTexture ] = true ;
if ( sd . LongLowTexture ! = MapSet . EmptyLongName ) usedtextures [ sd . LongLowTexture ] = true ;
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
}
2009-04-19 18:07:22 +00:00
}
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
lock ( usedflats )
2009-04-19 18:07:22 +00:00
{
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
usedflats . Clear ( ) ;
// Go through the map to find the used flats
foreach ( Sector s in General . Map . Map . Sectors )
{
// Add used flats to dictionary
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
usedflats [ s . LongFloorTexture ] = false ;
usedflats [ s . LongCeilTexture ] = false ;
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
}
2009-04-19 18:07:22 +00:00
}
}
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
// Notify the background thread that it needs to update the images
updatedusedtextures = true ;
2009-04-19 18:07:22 +00:00
}
2016-01-11 13:00:52 +00:00
#endregion
#region = = = = = = = = = = = = = = = = = = mxd . Skybox Making
2016-01-15 18:20:47 +00:00
internal void SetupSkybox ( )
2016-01-11 13:00:52 +00:00
{
// Get rid of old texture
if ( skybox ! = null ) skybox . Dispose ( ) ; skybox = null ;
// Determine which texture name to use
string skytex = string . Empty ;
if ( ! string . IsNullOrEmpty ( mapinfo . Sky1 ) )
{
skytex = mapinfo . Sky1 ;
}
// Use vanilla sky only when current map doesn't have a MAPINFO entry
else if ( ! mapinfo . IsDefined )
{
if ( General . Map . Config . DefaultSkyTextures . ContainsKey ( General . Map . Options . CurrentName ) )
skytex = General . Map . Config . DefaultSkyTextures [ General . Map . Options . CurrentName ] ;
else
skytex = General . GetByIndex ( General . Map . Config . DefaultSkyTextures , 0 ) . Value ;
}
// Create sky texture
if ( ! string . IsNullOrEmpty ( skytex ) )
{
if ( skyboxes . ContainsKey ( skytex ) )
{
// Create cubemap texture
skybox = ( skyboxes [ skytex ] . Textures . Count = = 6 ? MakeSkyBox6 ( skyboxes [ skytex ] ) : MakeSkyBox3 ( skyboxes [ skytex ] ) ) ;
}
else
{
// Create classic texture
2016-01-13 09:34:32 +00:00
Bitmap img = GetTextureBitmap ( skytex ) ;
if ( img ! = null )
2016-01-11 13:00:52 +00:00
{
2016-01-14 11:39:52 +00:00
skybox = MakeClassicSkyBox ( img ) ;
2016-01-11 13:00:52 +00:00
}
}
}
// Sky texture will be missing in ZDoom. Use internal texture
if ( skybox = = null )
{
2016-01-15 22:19:48 +00:00
// Whine and moan
if ( string . IsNullOrEmpty ( skytex ) )
General . ErrorLogger . Add ( ErrorType . Warning , "Skybox creation failed: Sky1 property is missing from the MAPINFO map definition" ) ;
else
General . ErrorLogger . Add ( ErrorType . Warning , "Skybox creation failed: unable to load \"" + skytex + "\" texture" ) ;
// Use the built-in texture
2016-01-11 13:00:52 +00:00
ImageData tex = LoadInternalTexture ( "MissingSky3D.png" ) ;
tex . CreateTexture ( ) ;
2016-01-15 22:19:48 +00:00
Bitmap sky = new Bitmap ( tex . GetBitmap ( ) ) ;
sky . RotateFlip ( RotateFlipType . RotateNoneFlipX ) ; // We don't want our built-in image mirrored...
skybox = MakeClassicSkyBox ( sky ) ;
2016-01-11 13:00:52 +00:00
tex . Dispose ( ) ;
}
}
2016-01-14 11:39:52 +00:00
//INFO: 1. Looks like GZDoom tries to tile a sky texture into a 1024 pixel width texture.
//INFO: 2. If sky texture width <= height, it will be tiled to fit into 512 pixel height texture vertically.
private static CubeTexture MakeClassicSkyBox ( Bitmap img )
2016-01-11 13:00:52 +00:00
{
2016-01-14 11:39:52 +00:00
// Get averaged top and bottom colors from the original image
int tr = 0 , tg = 0 , tb = 0 , br = 0 , bg = 0 , bb = 0 ;
2016-01-18 11:02:03 +00:00
const int defaultcolorsampleheight = 28 ;
int colorsampleheight = Math . Max ( 1 , Math . Min ( defaultcolorsampleheight , img . Height / 2 ) ) ; // TODO: is this value calculated from the image's height?
bool dogradients = colorsampleheight < img . Height / 2 ;
2016-01-14 11:39:52 +00:00
for ( int w = 0 ; w < img . Width ; w + + )
2016-01-11 13:00:52 +00:00
{
2016-01-14 11:39:52 +00:00
for ( int h = 0 ; h < colorsampleheight ; h + + )
2016-01-11 13:00:52 +00:00
{
2016-01-14 11:39:52 +00:00
Color c = img . GetPixel ( w , h ) ;
2016-01-11 13:00:52 +00:00
tr + = c . R ;
tg + = c . G ;
tb + = c . B ;
2016-01-14 11:39:52 +00:00
c = img . GetPixel ( w , img . Height - 1 - h ) ;
2016-01-11 13:00:52 +00:00
br + = c . R ;
bg + = c . G ;
bb + = c . B ;
}
}
2016-01-14 11:39:52 +00:00
int pixelscount = img . Width * colorsampleheight ;
Color topcolor = Color . FromArgb ( 255 , tr / pixelscount , tg / pixelscount , tb / pixelscount ) ;
Color bottomcolor = Color . FromArgb ( 255 , br / pixelscount , bg / pixelscount , bb / pixelscount ) ;
2016-01-11 13:00:52 +00:00
2016-01-14 11:39:52 +00:00
// Make tiling image
int horiztiles = ( int ) Math . Ceiling ( 1024.0f / img . Width ) ;
int verttiles = img . Height > 256 ? 1 : 2 ;
2016-01-11 13:00:52 +00:00
2016-01-14 11:39:52 +00:00
Bitmap skyimage = new Bitmap ( 1024 , img . Height * verttiles , img . PixelFormat ) ;
2016-01-11 13:00:52 +00:00
2016-01-14 11:39:52 +00:00
// Draw original image
using ( Graphics g = Graphics . FromImage ( skyimage ) )
2016-01-11 13:00:52 +00:00
{
2016-01-14 11:39:52 +00:00
for ( int w = 0 ; w < horiztiles ; w + + )
2016-01-11 13:00:52 +00:00
{
2016-01-14 11:39:52 +00:00
for ( int h = 0 ; h < verttiles ; h + + )
{
g . DrawImage ( img , img . Width * w , img . Height * h ) ;
}
2016-01-11 13:00:52 +00:00
}
}
// Make top and bottom images
2016-01-14 11:39:52 +00:00
const int capsimgsize = 16 ;
Bitmap topimg = new Bitmap ( capsimgsize , capsimgsize ) ;
using ( Graphics g = Graphics . FromImage ( topimg ) )
2016-01-11 13:00:52 +00:00
{
using ( SolidBrush b = new SolidBrush ( topcolor ) )
2016-01-14 11:39:52 +00:00
g . FillRectangle ( b , 0 , 0 , capsimgsize , capsimgsize ) ;
2016-01-11 13:00:52 +00:00
}
2016-01-14 11:39:52 +00:00
Bitmap bottomimg = new Bitmap ( capsimgsize , capsimgsize ) ;
using ( Graphics g = Graphics . FromImage ( bottomimg ) )
2016-01-11 13:00:52 +00:00
{
using ( SolidBrush b = new SolidBrush ( bottomcolor ) )
2016-01-14 11:39:52 +00:00
g . FillRectangle ( b , 0 , 0 , capsimgsize , capsimgsize ) ;
2016-01-11 13:00:52 +00:00
}
// Apply top/bottom gradients
2016-01-18 11:02:03 +00:00
if ( dogradients )
2016-01-11 13:00:52 +00:00
{
2016-01-18 11:02:03 +00:00
using ( Graphics g = Graphics . FromImage ( skyimage ) )
2016-01-11 13:00:52 +00:00
{
2016-01-18 11:02:03 +00:00
Rectangle area = new Rectangle ( 0 , 0 , skyimage . Width , colorsampleheight ) ;
using ( LinearGradientBrush b = new LinearGradientBrush ( area , topcolor , Color . FromArgb ( 0 , topcolor ) , 90f ) )
{
g . FillRectangle ( b , area ) ;
}
2016-01-11 13:00:52 +00:00
2016-01-18 11:02:03 +00:00
area = new Rectangle ( 0 , skyimage . Height - colorsampleheight , skyimage . Width , colorsampleheight ) ;
using ( LinearGradientBrush b = new LinearGradientBrush ( area , Color . FromArgb ( 0 , bottomcolor ) , bottomcolor , 90f ) )
{
area . Y + = 1 ;
g . FillRectangle ( b , area ) ;
}
2016-01-11 13:00:52 +00:00
}
}
2016-01-14 22:15:54 +00:00
// Get Device and shader...
2016-01-14 11:39:52 +00:00
Device device = General . Map . Graphics . Device ;
World3DShader effect = General . Map . Graphics . Shaders . World3D ;
2016-01-14 22:15:54 +00:00
// Make custom rendertarget
const int cubemaptexsize = 1024 ;
Surface rendertarget = Surface . CreateRenderTarget ( device , cubemaptexsize , cubemaptexsize , Format . A8R8G8B8 , MultisampleType . None , 0 , false ) ;
Surface depthbuffer = Surface . CreateDepthStencil ( device , cubemaptexsize , cubemaptexsize , General . Map . Graphics . DepthBuffer . Description . Format , MultisampleType . None , 0 , false ) ;
// Start rendering
if ( ! General . Map . Graphics . StartRendering ( true , new Color4 ( ) , rendertarget , depthbuffer ) )
{
General . ErrorLogger . Add ( ErrorType . Error , "Skybox creation failed: unable to start rendering..." ) ;
// Get rid of unmanaged stuff...
rendertarget . Dispose ( ) ;
depthbuffer . Dispose ( ) ;
// No dice...
return null ;
}
// Load the skysphere model...
2016-01-14 11:39:52 +00:00
BoundingBoxSizes bbs = new BoundingBoxSizes ( ) ;
Stream modeldata = General . ThisAssembly . GetManifestResourceStream ( "CodeImp.DoomBuilder.Resources.SkySphere.md3" ) ;
2016-01-14 22:15:54 +00:00
ModelReader . MD3LoadResult meshes = ModelReader . ReadMD3Model ( ref bbs , true , modeldata , device , 0 ) ;
if ( meshes . Meshes . Count ! = 3 ) throw new Exception ( "Skybox creation failed: " + meshes . Errors ) ;
2016-01-14 11:39:52 +00:00
// Make skysphere textures...
Texture texside = TextureFromBitmap ( device , skyimage ) ;
Texture textop = TextureFromBitmap ( device , topimg ) ;
Texture texbottom = TextureFromBitmap ( device , bottomimg ) ;
// Calculate model scaling (gl.skydone.cpp:RenderDome() in GZDoom)
float yscale ;
if ( img . Height < 128 ) yscale = 128 / 230.0f ;
else if ( img . Height < 200 ) yscale = img . Height / 230.0f ;
else if ( img . Height < 241 ) yscale = 1.0f + ( ( img . Height - 200.0f ) / 200.0f ) * 1.17f ;
else yscale = 1.2f * 1.17f ;
2016-01-15 18:20:47 +00:00
// I guess my sky model doesn't exactly match the one GZDoom generates...
yscale * = 1.65f ;
2016-01-11 13:00:52 +00:00
// Make cubemap texture
2016-01-14 22:15:54 +00:00
CubeTexture cubemap = new CubeTexture ( device , cubemaptexsize , 1 , Usage . None , Format . A8R8G8B8 , Pool . Managed ) ;
Surface sysmemsurf = Surface . CreateOffscreenPlain ( device , cubemaptexsize , cubemaptexsize , Format . A8R8G8B8 , Pool . SystemMemory ) ;
2016-01-11 13:00:52 +00:00
2016-01-14 11:39:52 +00:00
// Set render settings...
device . SetRenderState ( RenderState . ZEnable , false ) ;
device . SetRenderState ( RenderState . CullMode , Cull . None ) ;
2016-02-02 21:07:15 +00:00
device . SetSamplerState ( 0 , SamplerState . AddressU , TextureAddress . Clamp ) ;
device . SetSamplerState ( 0 , SamplerState . AddressV , TextureAddress . Clamp ) ;
2016-01-14 22:15:54 +00:00
2016-01-14 11:39:52 +00:00
// Setup matrices
Vector3 offset = new Vector3 ( 0f , 0f , - 1.8f ) ; // Sphere size is 10 mu
Matrix mworld = Matrix . Multiply ( Matrix . Identity , Matrix . Translation ( offset ) * Matrix . Scaling ( 1.0f , 1.0f , yscale ) ) ;
Matrix mprojection = Matrix . PerspectiveFovLH ( Angle2D . PIHALF , 1.0f , 0.5f , 100.0f ) ;
2016-01-11 13:00:52 +00:00
2016-01-14 11:39:52 +00:00
// Place camera at origin
effect . CameraPosition = new Vector4 ( ) ;
2016-01-11 13:00:52 +00:00
2016-01-14 22:15:54 +00:00
// Begin fullbright shaderpass
2016-01-14 11:39:52 +00:00
effect . Begin ( ) ;
2016-01-14 22:15:54 +00:00
effect . BeginPass ( 1 ) ;
2016-01-14 11:39:52 +00:00
// Render to the six faces of the cube map
for ( int i = 0 ; i < 6 ; i + + )
{
Matrix faceview = GetCubeMapViewMatrix ( ( CubeMapFace ) i ) ;
effect . WorldViewProj = mworld * faceview * mprojection ;
// Render the skysphere meshes
2016-01-14 22:15:54 +00:00
for ( int j = 0 ; j < meshes . Meshes . Count ; j + + )
2016-01-14 11:39:52 +00:00
{
// Set appropriate texture
2016-01-14 22:15:54 +00:00
switch ( meshes . Skins [ j ] )
2016-01-14 11:39:52 +00:00
{
case "top.png" : effect . Texture1 = textop ; break ;
case "bottom.png" : effect . Texture1 = texbottom ; break ;
case "side.png" : effect . Texture1 = texside ; break ;
default : throw new Exception ( "Unexpected skin!" ) ;
}
// Commit changes
effect . ApplySettings ( ) ;
// Render mesh
2016-01-14 22:15:54 +00:00
meshes . Meshes [ j ] . DrawSubset ( 0 ) ;
2016-01-14 11:39:52 +00:00
}
2016-01-14 22:15:54 +00:00
// Get rendered data from video memory...
device . GetRenderTargetData ( rendertarget , sysmemsurf ) ;
// ...Then copy it to destination texture
Surface targetsurf = cubemap . GetCubeMapSurface ( ( CubeMapFace ) i , 0 ) ;
DataRectangle sourcerect = sysmemsurf . LockRectangle ( LockFlags . NoSystemLock ) ;
DataRectangle targetrect = targetsurf . LockRectangle ( LockFlags . NoSystemLock ) ;
if ( sourcerect . Data . CanRead & & targetrect . Data . CanWrite )
{
byte [ ] data = new byte [ sourcerect . Data . Length ] ;
sourcerect . Data . ReadRange ( data , 0 , ( int ) sourcerect . Data . Length ) ;
targetrect . Data . Write ( data , 0 , data . Length ) ;
}
else
{
General . ErrorLogger . Add ( ErrorType . Error , "Skybox creation failed: unable to copy to CubeTexture surface..." ) ;
}
2016-01-14 11:39:52 +00:00
2016-01-14 22:15:54 +00:00
// Unlock and dispose
sysmemsurf . UnlockRectangle ( ) ;
targetsurf . UnlockRectangle ( ) ;
targetsurf . Dispose ( ) ;
2016-01-14 11:39:52 +00:00
}
// End rendering
effect . EndPass ( ) ;
effect . End ( ) ;
2016-01-14 22:15:54 +00:00
General . Map . Graphics . FinishRendering ( ) ;
2016-01-14 11:39:52 +00:00
// Dispose unneeded stuff
rendertarget . Dispose ( ) ;
2016-01-14 22:15:54 +00:00
depthbuffer . Dispose ( ) ;
sysmemsurf . Dispose ( ) ;
2016-01-14 11:39:52 +00:00
textop . Dispose ( ) ;
texside . Dispose ( ) ;
texbottom . Dispose ( ) ;
// Dispose skybox meshes
2016-01-14 22:15:54 +00:00
foreach ( Mesh m in meshes . Meshes ) m . Dispose ( ) ;
2016-01-11 13:00:52 +00:00
// All done...
return cubemap ;
}
// Makes CubeTexture from 6 images
private CubeTexture MakeSkyBox6 ( SkyboxInfo info )
{
// Gather images. They should be defined in this order: North, East, South, West, Top, Bottom
Bitmap [ ] sides = new Bitmap [ 6 ] ;
int targetsize = 0 ;
for ( int i = 0 ; i < info . Textures . Count ; i + + )
{
2016-01-13 09:34:32 +00:00
sides [ i ] = GetTextureBitmap ( info . Textures [ i ] ) ;
if ( sides [ i ] ! = null )
2016-01-11 13:00:52 +00:00
{
2016-01-13 09:34:32 +00:00
targetsize = Math . Max ( targetsize , Math . Max ( sides [ i ] . Width , sides [ i ] . Height ) ) ;
2016-01-11 13:00:52 +00:00
}
2016-01-13 09:34:32 +00:00
else
2016-01-11 13:00:52 +00:00
{
General . ErrorLogger . Add ( ErrorType . Error , "Unable to create \"" + info . Name + "\" skybox: unable to find \"" + info . Textures [ i ] + "\" texture" ) ;
return null ;
}
}
// All images must be square and have the same size
if ( targetsize = = 0 )
{
General . ErrorLogger . Add ( ErrorType . Error , "Unable to create \"" + info . Name + "\" skybox: invalid texture size" ) ;
return null ;
}
// Make it Po2
targetsize = General . NextPowerOf2 ( targetsize ) ;
for ( int i = 0 ; i < sides . Length ; i + + )
{
if ( sides [ i ] . Width ! = targetsize | | sides [ i ] . Height ! = targetsize )
sides [ i ] = ResizeImage ( sides [ i ] , targetsize , targetsize ) ;
}
// Return cubemap texture
return MakeSkyBox ( sides , targetsize , info . FlipTop ) ;
}
// Makes CubeTexture from 3 images
private CubeTexture MakeSkyBox3 ( SkyboxInfo info )
{
// Gather images. They should be defined in this order: Sides, Top, Bottom
Bitmap [ ] sides = new Bitmap [ 6 ] ;
int targetsize = 0 ;
// Create NWSE images from the side texture
2016-01-13 09:34:32 +00:00
Bitmap sideimg = GetTextureBitmap ( info . Textures [ 0 ] ) ;
if ( sideimg ! = null )
2016-01-11 13:00:52 +00:00
{
2016-01-13 09:34:32 +00:00
// This should be 4x1 format image. If it's not, we'll need to resize it
targetsize = Math . Max ( sideimg . Width / 4 , sideimg . Height ) ;
if ( targetsize = = 0 )
2016-01-11 13:00:52 +00:00
{
2016-01-13 09:34:32 +00:00
General . ErrorLogger . Add ( ErrorType . Error , "Unable to create \"" + info . Name + "\" skybox: invalid texture size" ) ;
return null ;
}
2016-01-11 13:00:52 +00:00
2016-01-13 09:34:32 +00:00
// Make it Po2
targetsize = General . NextPowerOf2 ( targetsize ) ;
2016-01-11 13:00:52 +00:00
2016-01-13 09:34:32 +00:00
// Resize if needed
if ( sideimg . Width ! = targetsize * 4 | | sideimg . Height ! = targetsize )
{
sideimg = ResizeImage ( sideimg , targetsize * 4 , targetsize ) ;
}
2016-01-11 13:00:52 +00:00
2016-01-13 09:34:32 +00:00
// Chop into tiny pieces
for ( int i = 0 ; i < 4 ; i + + )
{
// Create square image
Bitmap img = new Bitmap ( targetsize , targetsize ) ;
using ( Graphics g = Graphics . FromImage ( img ) )
2016-01-11 13:00:52 +00:00
{
2016-01-13 09:34:32 +00:00
// Copy area from the side image
g . DrawImage ( sideimg , 0 , 0 , new Rectangle ( targetsize * i , 0 , targetsize , targetsize ) , GraphicsUnit . Pixel ) ;
2016-01-11 13:00:52 +00:00
}
2016-01-13 09:34:32 +00:00
// Add to collection
sides [ i ] = img ;
2016-01-11 13:00:52 +00:00
}
}
// Sanity check...
if ( sides [ 0 ] = = null | | sides [ 1 ] = = null | | sides [ 2 ] = = null | | sides [ 3 ] = = null )
{
General . ErrorLogger . Add ( ErrorType . Error , "Unable to create \"" + info . Name + "\" skybox: unable to find \"" + info . Textures [ 0 ] + "\" texture" ) ;
return null ;
}
// Create top
2016-01-13 09:34:32 +00:00
Bitmap topimg = GetTextureBitmap ( info . Textures [ 1 ] ) ;
if ( topimg ! = null )
2016-01-11 13:00:52 +00:00
{
2016-01-13 09:34:32 +00:00
// Resize if needed
if ( topimg . Width ! = targetsize | | topimg . Height ! = targetsize )
topimg = ResizeImage ( topimg , targetsize , targetsize ) ;
2016-01-11 13:00:52 +00:00
2016-01-13 09:34:32 +00:00
// Add to collection
sides [ 4 ] = topimg ;
2016-01-11 13:00:52 +00:00
}
2016-01-13 09:34:32 +00:00
else
2016-01-11 13:00:52 +00:00
{
General . ErrorLogger . Add ( ErrorType . Error , "Unable to create \"" + info . Name + "\" skybox: unable to find \"" + info . Textures [ 1 ] + "\" texture" ) ;
return null ;
}
// Create bottom
2016-01-13 09:34:32 +00:00
Bitmap bottomimg = GetTextureBitmap ( info . Textures [ 2 ] ) ;
if ( bottomimg ! = null )
2016-01-11 13:00:52 +00:00
{
2016-01-13 09:34:32 +00:00
// Resize if needed
if ( bottomimg . Width ! = targetsize | | bottomimg . Height ! = targetsize )
bottomimg = ResizeImage ( bottomimg , targetsize , targetsize ) ;
2016-01-11 13:00:52 +00:00
2016-01-13 09:34:32 +00:00
// Add to collection
sides [ 5 ] = bottomimg ;
2016-01-11 13:00:52 +00:00
}
2016-01-13 09:34:32 +00:00
else
2016-01-11 13:00:52 +00:00
{
General . ErrorLogger . Add ( ErrorType . Error , "Unable to create \"" + info . Name + "\" skybox: unable to find \"" + info . Textures [ 2 ] + "\" texture" ) ;
return null ;
}
// Return cubemap texture
return MakeSkyBox ( sides , targetsize , info . FlipTop ) ;
}
// Makes CubeTexture from 6 images.
// sides[] must contain 6 square Po2 images in this order: North, East, South, West, Top, Bottom
private static CubeTexture MakeSkyBox ( Bitmap [ ] sides , int targetsize , bool fliptop )
{
CubeTexture cubemap = new CubeTexture ( General . Map . Graphics . Device , targetsize , 1 , Usage . None , Format . A8R8G8B8 , Pool . Managed ) ;
// Draw faces
sides [ 3 ] . RotateFlip ( RotateFlipType . Rotate180FlipX ) ;
DrawCubemapFace ( cubemap , CubeMapFace . NegativeX , sides [ 3 ] ) ; // West
sides [ 0 ] . RotateFlip ( RotateFlipType . Rotate90FlipX ) ;
DrawCubemapFace ( cubemap , CubeMapFace . NegativeY , sides [ 0 ] ) ; // North
sides [ 1 ] . RotateFlip ( RotateFlipType . RotateNoneFlipX ) ;
DrawCubemapFace ( cubemap , CubeMapFace . PositiveX , sides [ 1 ] ) ; // East
sides [ 2 ] . RotateFlip ( RotateFlipType . Rotate270FlipX ) ;
DrawCubemapFace ( cubemap , CubeMapFace . PositiveY , sides [ 2 ] ) ; // South
sides [ 4 ] . RotateFlip ( fliptop ? RotateFlipType . Rotate90FlipX : RotateFlipType . Rotate90FlipNone ) ;
DrawCubemapFace ( cubemap , CubeMapFace . PositiveZ , sides [ 4 ] ) ; // Top
sides [ 5 ] . RotateFlip ( RotateFlipType . Rotate270FlipX ) ;
DrawCubemapFace ( cubemap , CubeMapFace . NegativeZ , sides [ 5 ] ) ; // Bottom
// All done...
return cubemap ;
}
private static void DrawCubemapFace ( CubeTexture texture , CubeMapFace face , Bitmap image )
{
DataRectangle rect = texture . LockRectangle ( face , 0 , LockFlags . NoSystemLock ) ;
SurfaceDescription desc = texture . GetLevelDescription ( 0 ) ;
if ( rect . Data . CanWrite )
{
for ( int row = 0 ; row < desc . Height ; row + + )
{
int rowstart = row * rect . Pitch ;
rect . Data . Seek ( rowstart , SeekOrigin . Begin ) ;
for ( int col = 0 ; col < desc . Width ; col + + )
{
Color color = image . GetPixel ( row , col ) ;
rect . Data . WriteByte ( color . B ) ;
rect . Data . WriteByte ( color . G ) ;
rect . Data . WriteByte ( color . R ) ;
rect . Data . WriteByte ( color . A ) ;
}
}
}
else
{
General . ErrorLogger . Add ( ErrorType . Error , "Skybox creation failed: CubeTexture is unwritable..." ) ;
}
texture . UnlockRectangle ( face , 0 ) ;
}
private static Bitmap ResizeImage ( Image image , int width , int height )
{
var destrect = new Rectangle ( 0 , 0 , width , height ) ;
var destimage = new Bitmap ( width , height ) ;
destimage . SetResolution ( image . HorizontalResolution , image . VerticalResolution ) ;
using ( var graphics = Graphics . FromImage ( destimage ) )
{
graphics . CompositingMode = CompositingMode . SourceCopy ;
graphics . CompositingQuality = CompositingQuality . HighQuality ;
graphics . InterpolationMode = InterpolationMode . HighQualityBicubic ;
graphics . SmoothingMode = SmoothingMode . HighQuality ;
graphics . PixelOffsetMode = PixelOffsetMode . HighQuality ;
using ( var wrapmode = new ImageAttributes ( ) )
{
wrapmode . SetWrapMode ( WrapMode . TileFlipXY ) ;
graphics . DrawImage ( image , destrect , 0 , 0 , image . Width , image . Height , GraphicsUnit . Pixel , wrapmode ) ;
}
}
return destimage ;
}
2016-01-14 11:39:52 +00:00
private static Matrix GetCubeMapViewMatrix ( CubeMapFace face )
{
Vector3 lookdir , updir ;
switch ( face )
{
case CubeMapFace . PositiveX :
lookdir = new Vector3 ( 1.0f , 0.0f , 0.0f ) ;
updir = new Vector3 ( 0.0f , 1.0f , 0.0f ) ;
break ;
case CubeMapFace . NegativeX :
lookdir = new Vector3 ( - 1.0f , 0.0f , 0.0f ) ;
updir = new Vector3 ( 0.0f , 1.0f , 0.0f ) ;
break ;
case CubeMapFace . PositiveY :
lookdir = new Vector3 ( 0.0f , 1.0f , 0.0f ) ;
updir = new Vector3 ( 0.0f , 0.0f , - 1.0f ) ;
break ;
case CubeMapFace . NegativeY :
lookdir = new Vector3 ( 0.0f , - 1.0f , 0.0f ) ;
updir = new Vector3 ( 0.0f , 0.0f , 1.0f ) ;
break ;
case CubeMapFace . PositiveZ :
lookdir = new Vector3 ( 0.0f , 0.0f , 1.0f ) ;
updir = new Vector3 ( 0.0f , 1.0f , 0.0f ) ;
break ;
case CubeMapFace . NegativeZ :
lookdir = new Vector3 ( 0.0f , 0.0f , - 1.0f ) ;
updir = new Vector3 ( 0.0f , 1.0f , 0.0f ) ;
break ;
default :
throw new Exception ( "Unknown CubeMapFace!" ) ;
}
Vector3 eye = new Vector3 ( ) ;
return Matrix . LookAtLH ( eye , lookdir , updir ) ;
}
private static Texture TextureFromBitmap ( Device device , Image image )
{
2016-02-02 21:07:15 +00:00
using ( MemoryStream ms = new MemoryStream ( ) )
{
image . Save ( ms , ImageFormat . Png ) ;
ms . Seek ( 0 , SeekOrigin . Begin ) ;
2016-01-14 11:39:52 +00:00
2016-02-02 21:07:15 +00:00
// Classic skies textures can be NPo2 (and D3D Texture is resized to Po2 by default),
// so we need to explicitly specify the size
return Texture . FromStream ( device , ms , ( int ) ms . Length ,
image . Size . Width , image . Size . Height , 0 , Usage . None , Format . Unknown ,
Pool . Managed , Filter . None , Filter . None , 0 ) ;
}
2016-01-14 11:39:52 +00:00
}
2009-04-19 18:07:22 +00:00
#endregion
}
}