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 ;
using System.Collections.Generic ;
using System.IO ;
using CodeImp.DoomBuilder.IO ;
using CodeImp.DoomBuilder.ZDoom ;
2012-06-01 10:17:47 +00:00
using CodeImp.DoomBuilder.GZBuilder.Data ;
2014-01-08 09:46:57 +00:00
using System.Text.RegularExpressions ;
2009-04-19 18:07:22 +00:00
#endregion
namespace CodeImp.DoomBuilder.Data
{
internal sealed class WADReader : DataReader
{
#region = = = = = = = = = = = = = = = = = = Constants
#endregion
#region = = = = = = = = = = = = = = = = = = Structures
private struct LumpRange
{
public int start ;
public int end ;
}
#endregion
#region = = = = = = = = = = = = = = = = = = Variables
// Source
private WAD file ;
private bool is_iwad ;
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 readonly bool strictpatches ;
2009-04-19 18:07:22 +00:00
// Lump ranges
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 readonly List < LumpRange > flatranges ;
private readonly List < LumpRange > invertedflatranges ; //mxd
private readonly List < LumpRange > patchranges ;
private readonly List < LumpRange > spriteranges ;
private readonly List < LumpRange > textureranges ;
2016-03-04 08:10:56 +00:00
private readonly List < LumpRange > hiresranges ; //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
private readonly List < LumpRange > colormapranges ;
private readonly List < LumpRange > voxelranges ; //mxd
2009-04-19 18:07:22 +00:00
#endregion
#region = = = = = = = = = = = = = = = = = = Properties
public bool IsIWAD { get { return is_iwad ; } }
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 WAD WadFile { get { return file ; } } //mxd
2009-04-19 18:07:22 +00:00
#endregion
#region = = = = = = = = = = = = = = = = = = Constructor / Disposer
// Constructor
public WADReader ( DataLocation dl ) : base ( dl )
{
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 ( "Opening WAD resource \"" + location . location + "\"" ) ;
2009-04-19 18:07:22 +00:00
2010-10-03 16:54:38 +00:00
if ( ! File . Exists ( location . location ) )
throw new FileNotFoundException ( "Could not find the file \"" + location . location + "\"" , location . location ) ;
2009-04-19 18:07:22 +00:00
// Initialize
file = new WAD ( location . location , true ) ;
2016-03-14 10:25:27 +00:00
is_iwad = file . IsIWAD ;
2009-04-19 18:07:22 +00:00
strictpatches = dl . option1 ;
patchranges = new List < LumpRange > ( ) ;
spriteranges = new List < LumpRange > ( ) ;
flatranges = new List < LumpRange > ( ) ;
textureranges = new List < LumpRange > ( ) ;
2016-03-04 08:10:56 +00:00
hiresranges = new List < LumpRange > ( ) ; //mxd
2009-05-12 09:50:08 +00:00
colormapranges = new List < LumpRange > ( ) ;
2014-01-08 09:46:57 +00:00
voxelranges = new List < LumpRange > ( ) ; //mxd
2009-04-19 18:07:22 +00:00
// Find ranges
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
FindRanges ( patchranges , General . Map . Config . PatchRanges , "patches" , "Patch" ) ;
FindRanges ( spriteranges , General . Map . Config . SpriteRanges , "sprites" , "Sprite" ) ;
FindRanges ( flatranges , General . Map . Config . FlatRanges , "flats" , "Flat" ) ;
FindRanges ( textureranges , General . Map . Config . TextureRanges , "textures" , "Texture" ) ;
2016-03-04 08:10:56 +00:00
FindRanges ( hiresranges , General . Map . Config . HiResRanges , "hires" , "HiRes 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
FindRanges ( colormapranges , General . Map . Config . ColormapRanges , "colormaps" , "Colormap" ) ;
FindRanges ( voxelranges , General . Map . Config . VoxelRanges , "voxels" , "Voxel" ) ;
2009-04-19 18:07:22 +00:00
2013-12-02 15:02:01 +00:00
//mxd
invertedflatranges = new List < LumpRange > ( ) ;
2014-12-03 23:15:26 +00:00
if ( flatranges . Count > 0 )
{
2014-04-09 10:16:33 +00:00
//add range before the first flatrange
2015-12-28 15:01:53 +00:00
if ( flatranges [ 0 ] . start > 0 )
2014-12-03 23:15:26 +00:00
{
2014-04-03 12:57:02 +00:00
LumpRange range = new LumpRange { start = 0 , end = flatranges [ 0 ] . start - 1 } ;
invertedflatranges . Add ( range ) ;
}
2013-12-02 15:02:01 +00:00
2014-04-08 11:09:05 +00:00
//add ranges between flatranges
2014-12-03 23:15:26 +00:00
for ( int i = 1 ; i < flatranges . Count ; i + + )
{
2014-04-08 11:09:05 +00:00
LumpRange range = new LumpRange { start = flatranges [ i - 1 ] . end + 1 , end = flatranges [ i ] . start - 1 } ;
invertedflatranges . Add ( range ) ;
}
2014-04-09 10:16:33 +00:00
//add range after the last flatrange
2014-12-03 23:15:26 +00:00
if ( flatranges [ flatranges . Count - 1 ] . end < file . Lumps . Count - 1 )
{
2014-04-08 11:09:05 +00:00
LumpRange range = new LumpRange { start = flatranges [ flatranges . Count - 1 ] . end + 1 , end = file . Lumps . Count - 1 } ;
2013-12-02 15:02:01 +00:00
invertedflatranges . Add ( range ) ;
}
2014-12-03 23:15:26 +00:00
}
else // No flat ranges? Make one giant range then...
{
2014-04-08 11:09:05 +00:00
LumpRange range = new LumpRange { start = 0 , end = file . Lumps . Count - 1 } ;
invertedflatranges . Add ( range ) ;
2013-12-02 15:02:01 +00:00
}
2009-04-19 18:07:22 +00:00
// We have no destructor
GC . SuppressFinalize ( this ) ;
}
// Disposer
public override void Dispose ( )
{
// Not already disposed?
if ( ! isdisposed )
{
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 ( "Closing WAD resource \"" + location . location + "\"" ) ;
2009-04-19 18:07:22 +00:00
// Clean up
file . Dispose ( ) ;
// Done
base . Dispose ( ) ;
}
}
#endregion
#region = = = = = = = = = = = = = = = = = = Management
// Return a short name for this data location
public override string GetTitle ( )
{
return Path . GetFileName ( location . location ) ;
}
// This suspends use of this resource
public override void Suspend ( )
{
file . Dispose ( ) ;
base . Suspend ( ) ;
}
// This resumes use of this resource
public override void Resume ( )
{
file = new WAD ( location . location , true ) ;
2016-03-14 10:25:27 +00:00
is_iwad = file . IsIWAD ;
2009-04-19 18:07:22 +00:00
base . Resume ( ) ;
}
// This fills a ranges list
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 void FindRanges ( List < LumpRange > ranges , IDictionary rangeinfos , string rangename , string elementname )
2009-04-19 18:07:22 +00:00
{
2014-10-31 13:53:43 +00:00
Dictionary < LumpRange , KeyValuePair < string , string > > failedranges = new Dictionary < LumpRange , KeyValuePair < string , string > > ( ) ; //mxd
Dictionary < int , bool > successfulrangestarts = new Dictionary < int , bool > ( ) ; //mxd
Dictionary < int , bool > failedrangestarts = new Dictionary < int , bool > ( ) ; //mxd
2009-04-19 18:07:22 +00:00
foreach ( DictionaryEntry r in rangeinfos )
{
// Read start and end
string rangestart = General . Map . Config . ReadSetting ( rangename + "." + r . Key + ".start" , "" ) ;
string rangeend = General . Map . Config . ReadSetting ( rangename + "." + r . Key + ".end" , "" ) ;
if ( ( rangestart . Length > 0 ) & & ( rangeend . Length > 0 ) )
{
// Find ranges
int startindex = file . FindLumpIndex ( rangestart ) ;
while ( startindex > - 1 )
{
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
LumpRange range = new LumpRange { start = startindex , end = file . FindLumpIndex ( rangeend , startindex ) } ;
2009-04-19 18:07:22 +00:00
if ( range . end > - 1 )
{
2014-10-31 13:53:43 +00:00
if ( ! successfulrangestarts . ContainsKey ( startindex ) ) successfulrangestarts . Add ( startindex , false ) ; //mxd
2009-04-19 18:07:22 +00:00
ranges . Add ( range ) ;
startindex = file . FindLumpIndex ( rangestart , range . end ) ;
}
else
{
2014-10-31 13:53:43 +00:00
//mxd
2015-12-28 15:01:53 +00:00
if ( ! failedrangestarts . ContainsKey ( startindex ) )
2014-10-31 13:53:43 +00:00
{
failedranges . Add ( range , new KeyValuePair < string , string > ( rangestart , rangeend ) ) ; //mxd
failedrangestarts . Add ( startindex , false ) ;
}
2009-04-19 18:07:22 +00:00
startindex = - 1 ;
}
}
}
}
2014-10-31 13:53:43 +00:00
2016-03-14 10:25:27 +00:00
// Don't check official IWADs
if ( ! file . IsOfficialIWAD )
2014-10-31 13:53:43 +00:00
{
2016-03-14 10:25:27 +00:00
//mxd. Display warnings for unclosed ranges
foreach ( KeyValuePair < LumpRange , KeyValuePair < string , string > > group in failedranges )
{
if ( successfulrangestarts . ContainsKey ( group . Key . start ) ) continue ;
2016-03-14 21:53:53 +00:00
General . ErrorLogger . Add ( ErrorType . Warning , "\"" + group . Value . Key + "\" range at index " + group . Key . start + " is not closed in resource \"" + location . GetDisplayName ( ) + "\" (\"" + group . Value . Value + "\" marker is missing)." ) ;
2016-03-14 10:25:27 +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
2016-03-14 10:25:27 +00:00
//mxd. Check duplicates
foreach ( LumpRange range in ranges )
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
{
2016-03-14 10:25:27 +00:00
HashSet < string > names = new HashSet < string > ( StringComparer . OrdinalIgnoreCase ) ;
for ( int i = range . start + 1 ; i < range . end ; i + + )
{
if ( names . Contains ( file . Lumps [ i ] . Name ) )
2016-03-14 21:53:53 +00:00
General . ErrorLogger . Add ( ErrorType . Warning , elementname + " \"" + file . Lumps [ i ] . Name + "\", index " + i + " is double defined in resource \"" + location . GetDisplayName ( ) + "\"." ) ;
2016-03-14 10:25:27 +00:00
else
names . Add ( file . Lumps [ i ] . 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
}
2014-10-31 13:53:43 +00:00
}
2009-04-19 18:07:22 +00:00
}
#endregion
#region = = = = = = = = = = = = = = = = = = Palette
// This loads the PLAYPAL palette
public override Playpal LoadPalette ( )
{
// Error when suspended
if ( issuspended ) throw new Exception ( "Data reader is suspended" ) ;
// Look for a lump named PLAYPAL
2013-12-04 13:27:34 +00:00
Lump lump = file . FindLump ( "PLAYPAL" ) ;
if ( lump ! = null ) return new Playpal ( lump . Stream ) ; // Read the PLAYPAL from stream
return null ; // No palette
2009-04-19 18:07:22 +00:00
}
#endregion
2009-05-12 09:50:08 +00:00
#region = = = = = = = = = = = = = = = = = = Colormaps
// This loads the textures
public override ICollection < ImageData > LoadColormaps ( )
{
List < ImageData > images = new List < ImageData > ( ) ;
// Error when suspended
if ( issuspended ) throw new Exception ( "Data reader is suspended" ) ;
// Read ranges from configuration
foreach ( DictionaryEntry r in General . Map . Config . ColormapRanges )
{
// Read start and end
2015-12-28 15:01:53 +00:00
string rangestart = General . Map . Config . ReadSetting ( "colormaps." + r . Key + ".start" , "" ) ;
string rangeend = General . Map . Config . ReadSetting ( "colormaps." + r . Key + ".end" , "" ) ;
2009-05-12 09:50:08 +00:00
if ( ( rangestart . Length > 0 ) & & ( rangeend . Length > 0 ) )
{
// Load texture range
LoadColormapsRange ( rangestart , rangeend , ref images ) ;
}
}
// Add images to the container-specific texture set
2015-12-28 15:01:53 +00:00
foreach ( ImageData img in images ) textureset . AddFlat ( img ) ;
2009-05-12 09:50:08 +00:00
// Return result
return images ;
}
// This loads a range of colormaps
private void LoadColormapsRange ( string startlump , string endlump , ref List < ImageData > images )
{
// Continue until no more start can be found
2015-12-27 21:54:50 +00:00
int startindex = file . FindLumpIndex ( startlump ) ;
2009-05-12 09:50:08 +00:00
while ( startindex > - 1 )
{
// Find end index
2015-12-27 21:54:50 +00:00
int endindex = file . FindLumpIndex ( endlump , startindex + 1 ) ;
2009-05-12 09:50:08 +00:00
if ( endindex > - 1 )
{
// Go for all lumps between start and end exclusive
for ( int i = startindex + 1 ; i < endindex ; i + + )
{
// Lump not zero-length?
if ( file . Lumps [ i ] . Length > 0 )
{
// Make the image object
2015-12-27 21:54:50 +00:00
ColormapImage image = new ColormapImage ( file . Lumps [ i ] . Name ) ;
2009-05-12 09:50:08 +00:00
// Add image to collection
images . Add ( image ) ;
}
}
}
// Find the next start
startindex = file . FindLumpIndex ( startlump , startindex + 1 ) ;
}
}
// This finds and returns a colormap stream
public override Stream GetColormapData ( string pname )
{
// Error when suspended
if ( issuspended ) throw new Exception ( "Data reader is suspended" ) ;
2009-05-13 20:54:45 +00:00
// Strictly read patches only between C_START and C_END?
if ( strictpatches )
2009-05-12 09:50:08 +00:00
{
2009-05-13 20:54:45 +00:00
// Find the lump in ranges
foreach ( LumpRange range in colormapranges )
{
2015-12-27 21:54:50 +00:00
Lump lump = file . FindLump ( pname , range . start , range . end ) ;
2009-05-13 20:54:45 +00:00
if ( lump ! = null ) return lump . Stream ;
}
}
else
{
// Find the lump anywhere
2015-12-27 21:54:50 +00:00
Lump lump = file . FindLump ( pname ) ;
2009-05-12 09:50:08 +00:00
if ( lump ! = null ) return lump . Stream ;
}
return null ;
}
#endregion
2009-04-19 18:07:22 +00:00
#region = = = = = = = = = = = = = = = = = = Textures
// 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
public override IEnumerable < ImageData > LoadTextures ( PatchNames pnames , Dictionary < string , TexturesParser > cachedparsers )
2009-04-19 18:07:22 +00:00
{
2014-01-08 09:46:57 +00:00
// Error when suspended
if ( issuspended ) throw new Exception ( "Data reader is suspended" ) ;
2009-04-19 18:07:22 +00:00
List < ImageData > images = new List < ImageData > ( ) ;
2014-01-08 09:46:57 +00:00
float defaultscale = General . Map . Config . DefaultTextureScale ; //mxd
2009-04-19 18:07:22 +00:00
// Load two sets of textures, if available
2015-01-15 20:48:57 +00:00
Lump lump = file . FindLump ( "TEXTURE1" ) ;
if ( lump ! = null )
{
LoadTextureSet ( "TEXTURE1" , lump . Stream , ref images , pnames ) ;
if ( images . Count > 0 ) images . RemoveAt ( 0 ) ; //mxd. The first TEXTURE1 texture cannot be used. Let's remove it here
}
2009-04-19 18:07:22 +00:00
lump = file . FindLump ( "TEXTURE2" ) ;
if ( lump ! = null ) LoadTextureSet ( "TEXTURE2" , lump . Stream , ref images , pnames ) ;
// Read ranges from configuration
foreach ( LumpRange range in textureranges )
{
2014-01-08 09:46:57 +00:00
// Go for all lumps between start and end exclusive
2014-12-03 23:15:26 +00:00
for ( int i = range . start + 1 ; i < range . end ; i + + )
{
2014-01-08 09:46:57 +00:00
// Lump not zero length?
2014-12-03 23:15:26 +00:00
if ( file . Lumps [ i ] . Length > 0 )
{
2014-01-08 09:46:57 +00:00
// Make the image
SimpleTextureImage image = new SimpleTextureImage ( file . Lumps [ i ] . Name , file . Lumps [ i ] . Name , defaultscale , defaultscale ) ;
// Add image to collection
images . Add ( image ) ;
2014-12-03 23:15:26 +00:00
}
else
{
2014-01-08 09:46:57 +00:00
// Can't load image without size
2016-03-14 21:53:53 +00:00
General . ErrorLogger . Add ( ErrorType . Error , "Can't load texture \"" + file . Lumps [ i ] . Name + "\" from \"" + location . GetDisplayName ( ) + "\" because it doesn't contain any data." ) ;
2014-01-08 09:46:57 +00:00
}
}
2009-04-19 18:07:22 +00:00
}
2010-08-13 15:19:51 +00:00
2009-04-19 18:07:22 +00:00
// Load TEXTURES lump file
2015-01-15 20:48:57 +00:00
int lumpindex = file . FindLumpIndex ( "TEXTURES" ) ;
2010-08-13 15:19:51 +00:00
while ( lumpindex > - 1 )
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. Added TexturesParser caching
string fullpath = Path . Combine ( this . location . location , "TEXTURES#" + lumpindex ) ;
if ( cachedparsers . ContainsKey ( fullpath ) )
{
// Make the textures
foreach ( TextureStructure t in cachedparsers [ fullpath ] . Textures )
images . Add ( t . MakeImage ( ) ) ;
}
else
{
MemoryStream filedata = new MemoryStream ( file . Lumps [ lumpindex ] . Stream . ReadAllBytes ( ) ) ;
2016-03-04 08:10:56 +00:00
cachedparsers . Add ( fullpath , LoadTEXTURESTextures ( new TextResourceData ( this , filedata , "TEXTURES" , lumpindex , true ) , ref images ) ) ; //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
filedata . Dispose ( ) ;
}
2010-08-13 15:19:51 +00:00
// Find next
lumpindex = file . FindLumpIndex ( "TEXTURES" , lumpindex + 1 ) ;
2009-04-19 18:07:22 +00:00
}
2010-08-13 15:19:51 +00:00
2009-04-19 18:07:22 +00:00
// Add images to the container-specific texture set
2015-01-15 20:48:57 +00:00
foreach ( ImageData img in images ) textureset . AddTexture ( img ) ;
2009-04-19 18:07:22 +00:00
// Return result
return images ;
}
2016-03-04 08:10:56 +00:00
//mxd. This loads the HiRes textures
public override IEnumerable < HiResImage > LoadHiResTextures ( )
{
List < HiResImage > images = new List < HiResImage > ( ) ;
// Read ranges from configuration
foreach ( LumpRange range in hiresranges )
{
// Go for all lumps between start and end exclusive
for ( int i = range . start + 1 ; i < range . end ; i + + )
{
// Lump not zero length?
if ( file . Lumps [ i ] . Length > 0 )
{
// Add image to collection
images . Add ( new HiResImage ( file . Lumps [ i ] . Name ) ) ;
}
else
{
// Can't load image without size
2016-03-14 21:53:53 +00:00
General . ErrorLogger . Add ( ErrorType . Error , "Can't load HiRes texture \"" + file . Lumps [ i ] . Name + "\" from \"" + location . GetDisplayName ( ) + "\" because it doesn't contain any data." ) ;
2016-03-04 08:10:56 +00:00
}
}
}
return images ;
}
2009-04-19 18:07:22 +00:00
// This loads the texture definitions from a TEXTURES lump
2016-03-04 08:10:56 +00:00
public static TexturesParser LoadTEXTURESTextures ( TextResourceData data , ref List < ImageData > images )
2009-04-19 18:07:22 +00:00
{
// Parse the data
TexturesParser parser = new TexturesParser ( ) ;
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
if ( parser . HasError ) parser . LogError ( ) ; //mxd
2009-04-19 18:07:22 +00:00
// Make the textures
foreach ( TextureStructure t in parser . Textures )
{
2015-12-17 10:07:28 +00:00
// Add the texture
2016-03-04 08:10:56 +00:00
images . Add ( t . MakeImage ( ) ) ;
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
if ( ! General . Map . Data . TextResources . ContainsKey ( parser . ScriptType ) )
General . Map . Data . TextResources [ parser . ScriptType ] = new HashSet < TextResource > ( ) ;
foreach ( KeyValuePair < string , TextResource > group in parser . TextResources )
General . Map . Data . TextResources [ parser . ScriptType ] . Add ( group . Value ) ;
return parser ; //mxd
2009-04-19 18:07:22 +00:00
}
// This loads a set of textures
public static void LoadTextureSet ( string sourcename , Stream texturedata , ref List < ImageData > images , PatchNames pnames )
{
2013-12-03 10:50:33 +00:00
if ( texturedata . Length = = 0 ) return ;
2015-12-27 21:54:50 +00:00
BinaryReader reader = new BinaryReader ( texturedata ) ;
2010-08-14 15:44:47 +00:00
2009-04-19 18:07:22 +00:00
// Determine default scale
2015-12-27 21:54:50 +00:00
float defaultscale = General . Map . Config . DefaultTextureScale ;
2009-04-19 18:07:22 +00:00
// Get number of textures
texturedata . Seek ( 0 , SeekOrigin . Begin ) ;
2015-12-27 21:54:50 +00:00
uint numtextures = reader . ReadUInt32 ( ) ;
2009-04-19 18:07:22 +00:00
// Skip offset bytes (we will read all textures sequentially)
texturedata . Seek ( 4 * numtextures , SeekOrigin . Current ) ;
// Go for all textures defined in this lump
for ( uint i = 0 ; i < numtextures ; i + + )
{
// Read texture properties
2015-12-27 21:54:50 +00:00
byte [ ] namebytes = reader . ReadBytes ( 8 ) ;
int flags = reader . ReadUInt16 ( ) ;
byte scalebytex = reader . ReadByte ( ) ;
byte scalebytey = reader . ReadByte ( ) ;
int width = reader . ReadInt16 ( ) ;
int height = reader . ReadInt16 ( ) ;
int patches = reader . ReadInt16 ( ) ;
2009-04-19 18:07:22 +00:00
// Check for doom or strife data format
2015-12-27 21:54:50 +00:00
bool strifedata ;
2009-04-19 18:07:22 +00:00
if ( patches = = 0 )
{
// Ignore 2 bytes and then read number of patches
texturedata . Seek ( 2 , SeekOrigin . Current ) ;
patches = reader . ReadInt16 ( ) ;
strifedata = false ;
}
else
{
// Texture data is in strife format
strifedata = true ;
}
// Determine actual scales
2015-12-27 21:54:50 +00:00
float scalex = ( scalebytex = = 0 ? defaultscale : 1f / ( scalebytex / 8f ) ) ;
float scaley = ( scalebytey = = 0 ? defaultscale : 1f / ( scalebytey / 8f ) ) ;
2009-04-19 18:07:22 +00:00
// Validate data
2015-12-27 21:54:50 +00:00
if ( ( width > 0 ) & & ( height > 0 ) & & ( patches > 0 ) & & ( scalex ! = 0 ) | | ( scaley ! = 0 ) )
2009-04-19 18:07:22 +00:00
{
string texname = Lump . MakeNormalName ( namebytes , WAD . ENCODING ) ;
2015-12-27 21:54:50 +00:00
TextureImage image = null ;
2009-04-19 18:07:22 +00:00
if ( texname . Length > 0 )
{
// Make the image object
2015-03-22 20:43:05 +00:00
image = new TextureImage ( sourcename , Lump . MakeNormalName ( namebytes , WAD . ENCODING ) ,
2009-04-19 18:07:22 +00:00
width , height , scalex , scaley ) ;
}
else
{
// Can't load image without name
2009-05-10 16:02:08 +00:00
General . ErrorLogger . Add ( ErrorType . Error , "Can't load an unnamed texture from \"" + sourcename + "\". Please consider giving names to your resources." ) ;
2009-04-19 18:07:22 +00:00
}
// Go for all patches in texture
for ( int p = 0 ; p < patches ; p + + )
{
// Read patch properties
2015-12-27 21:54:50 +00:00
int px = reader . ReadInt16 ( ) ;
int py = reader . ReadInt16 ( ) ;
int pi = reader . ReadUInt16 ( ) ;
2009-04-19 18:07:22 +00:00
if ( ! strifedata ) texturedata . Seek ( 4 , SeekOrigin . Current ) ;
// Validate data
if ( ( pi > = 0 ) & & ( pi < pnames . Length ) )
{
if ( pnames [ pi ] . Length > 0 )
{
// Create patch on image
if ( image ! = null ) image . AddPatch ( new TexturePatch ( pnames [ pi ] , px , py ) ) ;
}
else
{
// Can't load image without name
2009-05-10 16:02:08 +00:00
General . ErrorLogger . Add ( ErrorType . Error , "Can't use an unnamed patch referenced in \"" + sourcename + "\". Please consider giving names to your resources." ) ;
2009-04-19 18:07:22 +00:00
}
}
}
// Add image to collection
2015-12-29 18:22:08 +00:00
if ( image ! = null ) images . Add ( image ) ;
2009-04-19 18:07:22 +00:00
}
else
{
// Skip patches data
texturedata . Seek ( 6 * patches , SeekOrigin . Current ) ;
if ( ! strifedata ) texturedata . Seek ( 4 * patches , SeekOrigin . Current ) ;
}
}
}
// This returns the patch names from the PNAMES lump
public override PatchNames LoadPatchNames ( )
{
// Error when suspended
if ( issuspended ) throw new Exception ( "Data reader is suspended" ) ;
// Look for a lump named PNAMES
2013-12-04 13:27:34 +00:00
Lump lump = file . FindLump ( "PNAMES" ) ;
if ( lump ! = null ) return new PatchNames ( lump . Stream ) ; // Read the PNAMES from stream
return null ; // No patch names found
2009-04-19 18:07:22 +00:00
}
// This finds and returns a patch stream
2016-03-14 21:53:53 +00:00
public override Stream GetPatchData ( string pname , bool longname , ref string patchlocation )
2009-04-19 18:07:22 +00:00
{
// Error when suspended
if ( issuspended ) throw new Exception ( "Data reader is suspended" ) ;
2014-11-25 11:52:01 +00:00
if ( longname ) return null ; //mxd
Lump lump ;
2009-04-19 18:07:22 +00:00
2013-12-02 15:02:01 +00:00
// mxd. First strictly read patches between P_START and P_END
2014-11-25 11:52:01 +00:00
foreach ( LumpRange range in patchranges )
{
2013-12-02 15:02:01 +00:00
lump = file . FindLump ( pname , range . start , range . end ) ;
if ( lump ! = null ) return lump . Stream ;
}
2015-12-28 15:01:53 +00:00
if ( ! strictpatches )
2014-11-25 11:52:01 +00:00
{
2013-12-02 15:02:01 +00:00
//mxd. Find the lump anywhere EXCEPT flat ranges (the way it's done in ZDoom)
2015-12-28 15:01:53 +00:00
foreach ( LumpRange range in invertedflatranges )
2014-11-25 11:52:01 +00:00
{
2009-04-19 18:07:22 +00:00
lump = file . FindLump ( pname , range . start , range . end ) ;
2016-03-14 21:53:53 +00:00
if ( lump ! = null )
{
patchlocation = location . GetDisplayName ( ) ;
return lump . Stream ;
}
2009-04-19 18:07:22 +00:00
}
2013-12-02 15:02:01 +00:00
// Find the lump anywhere IN flat ranges
2015-12-28 15:01:53 +00:00
foreach ( LumpRange range in flatranges )
2014-11-25 11:52:01 +00:00
{
2013-12-02 15:02:01 +00:00
lump = file . FindLump ( pname , range . start , range . end ) ;
2016-03-14 21:53:53 +00:00
if ( lump ! = null )
{
patchlocation = location . GetDisplayName ( ) ;
return lump . Stream ;
}
2013-09-11 09:47:53 +00:00
}
2009-04-19 18:07:22 +00:00
}
return null ;
}
// This finds and returns a texture stream
2016-03-14 21:53:53 +00:00
public override Stream GetTextureData ( string pname , bool longname , ref string texturelocation )
2009-04-19 18:07:22 +00:00
{
// Error when suspended
if ( issuspended ) throw new Exception ( "Data reader is suspended" ) ;
2014-11-25 11:52:01 +00:00
if ( longname ) return null ; //mxd
2009-04-19 18:07:22 +00:00
// Find the lump in ranges
foreach ( LumpRange range in textureranges )
{
2015-12-28 15:01:53 +00:00
Lump lump = file . FindLump ( pname , range . start , range . end ) ;
2016-03-14 21:53:53 +00:00
if ( lump ! = null )
{
texturelocation = location . GetDisplayName ( ) ; //mxd
return lump . Stream ;
}
2009-04-19 18:07:22 +00:00
}
return null ;
}
2009-05-12 09:50:08 +00:00
2016-03-04 08:10:56 +00:00
//mxd. This finds and returns a HiRes texture stream
2016-03-14 21:53:53 +00:00
public override Stream GetHiResTextureData ( string name , ref string hireslocation )
2016-03-04 08:10:56 +00:00
{
// Error when suspended
if ( issuspended ) throw new Exception ( "Data reader is suspended" ) ;
// Find the lump in ranges
foreach ( LumpRange range in hiresranges )
{
Lump lump = file . FindLump ( name , range . start , range . end ) ;
2016-03-14 21:53:53 +00:00
if ( lump ! = null )
{
hireslocation = location . GetDisplayName ( ) ;
return lump . Stream ;
}
2016-03-04 08:10:56 +00:00
}
return null ;
}
2009-04-19 18:07:22 +00:00
#endregion
#region = = = = = = = = = = = = = = = = = = Flats
2014-01-08 09:46:57 +00:00
//mxd. 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
public override IEnumerable < ImageData > LoadFlats ( Dictionary < string , TexturesParser > cachedparsers )
2014-11-25 11:52:01 +00:00
{
2009-04-19 18:07:22 +00:00
// Error when suspended
if ( issuspended ) throw new Exception ( "Data reader is suspended" ) ;
2014-01-08 09:46:57 +00:00
List < ImageData > images = new List < ImageData > ( ) ;
2014-11-25 11:52:01 +00:00
foreach ( LumpRange range in flatranges )
{
2014-01-08 09:46:57 +00:00
if ( range . end < range . start + 2 ) continue ;
2014-11-25 11:52:01 +00:00
for ( int i = range . start + 1 ; i < range . end ; i + + )
{
2014-01-08 09:46:57 +00:00
// Lump not zero-length?
2015-12-28 15:01:53 +00:00
if ( file . Lumps [ i ] . Length > 0 )
2014-11-25 11:52:01 +00:00
{
2014-01-08 09:46:57 +00:00
// Make the image object
2015-12-28 15:01:53 +00:00
FlatImage image = new FlatImage ( file . Lumps [ i ] . Name ) ;
2014-01-08 09:46:57 +00:00
// Add image to collection
images . Add ( image ) ;
}
2009-04-19 18:07:22 +00:00
}
}
2010-08-18 05:49:15 +00:00
// Load TEXTURES lump file
2014-01-08 09:46:57 +00:00
int lumpindex = file . FindLumpIndex ( "TEXTURES" ) ;
2014-11-25 11:52:01 +00:00
while ( lumpindex > - 1 )
{
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. Added TexturesParser caching
string fullpath = Path . Combine ( this . location . location , "TEXTURES#" + lumpindex ) ;
if ( cachedparsers . ContainsKey ( fullpath ) )
{
// Make the textures
foreach ( TextureStructure t in cachedparsers [ fullpath ] . Flats )
images . Add ( t . MakeImage ( ) ) ;
}
else
{
MemoryStream filedata = new MemoryStream ( file . Lumps [ lumpindex ] . Stream . ReadAllBytes ( ) ) ;
2016-03-04 08:10:56 +00:00
cachedparsers . Add ( fullpath , LoadTEXTURESFlats ( new TextResourceData ( this , filedata , "TEXTURES" , lumpindex , true ) , ref images ) ) ; //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
filedata . Dispose ( ) ;
}
2010-08-18 05:49:15 +00:00
// Find next
lumpindex = file . FindLumpIndex ( "TEXTURES" , lumpindex + 1 ) ;
}
2014-01-08 09:46:57 +00:00
2009-04-19 18:07:22 +00:00
// Add images to the container-specific texture set
2014-01-08 09:46:57 +00:00
foreach ( ImageData img in images ) textureset . AddFlat ( img ) ;
2009-04-19 18:07:22 +00:00
// Return result
return images ;
}
2010-08-18 05:49:15 +00:00
// This loads the flat definitions from a TEXTURES lump
2016-03-04 08:10:56 +00:00
public static TexturesParser LoadTEXTURESFlats ( TextResourceData data , ref List < ImageData > images )
2010-08-18 05:49:15 +00:00
{
// Parse the data
TexturesParser parser = new TexturesParser ( ) ;
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
if ( parser . HasError ) parser . LogError ( ) ; //mxd
2010-08-18 05:49:15 +00:00
2016-03-04 08:10:56 +00:00
// Make the flat
2010-08-18 05:49:15 +00:00
foreach ( TextureStructure t in parser . Flats )
{
2016-03-04 08:10:56 +00:00
// Add the flat
images . Add ( t . MakeImage ( ) ) ;
2010-08-18 05:49:15 +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
if ( ! General . Map . Data . TextResources . ContainsKey ( parser . ScriptType ) )
General . Map . Data . TextResources [ parser . ScriptType ] = new HashSet < TextResource > ( ) ;
foreach ( KeyValuePair < string , TextResource > group in parser . TextResources )
General . Map . Data . TextResources [ parser . ScriptType ] . Add ( group . Value ) ;
return parser ; //mxd
2010-08-18 05:49:15 +00:00
}
2009-04-19 18:07:22 +00:00
// This finds and returns a patch stream
2016-03-14 21:53:53 +00:00
public override Stream GetFlatData ( string pname , bool longname , ref string flatlocation )
2009-04-19 18:07:22 +00:00
{
// Error when suspended
if ( issuspended ) throw new Exception ( "Data reader is suspended" ) ;
2014-11-25 11:52:01 +00:00
if ( longname ) return null ; //mxd
2014-01-08 09:46:57 +00:00
2009-04-19 18:07:22 +00:00
// Find the lump in ranges
foreach ( LumpRange range in flatranges )
{
2015-12-28 15:01:53 +00:00
Lump lump = file . FindLump ( pname , range . start , range . end ) ;
2016-03-14 21:53:53 +00:00
if ( lump ! = null )
{
flatlocation = location . GetDisplayName ( ) ; //mxd
return lump . Stream ;
}
2009-04-19 18:07:22 +00:00
}
return null ;
}
#endregion
#region = = = = = = = = = = = = = = = = = = Sprite
2010-08-18 09:07:54 +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
public override IEnumerable < ImageData > LoadSprites ( Dictionary < string , TexturesParser > cachedparsers )
2010-08-18 09:07:54 +00:00
{
// Error when suspended
if ( issuspended ) throw new Exception ( "Data reader is suspended" ) ;
2014-01-08 09:46:57 +00:00
List < ImageData > images = new List < ImageData > ( ) ;
2010-08-18 09:07:54 +00:00
// Load TEXTURES lump file
2014-01-08 09:46:57 +00:00
int lumpindex = file . FindLumpIndex ( "TEXTURES" ) ;
2010-08-18 09:07:54 +00:00
while ( lumpindex > - 1 )
{
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. Added TexturesParser caching
string fullpath = Path . Combine ( this . location . location , "TEXTURES#" + lumpindex ) ;
if ( cachedparsers . ContainsKey ( fullpath ) )
{
// Make the textures
foreach ( TextureStructure t in cachedparsers [ fullpath ] . Sprites )
images . Add ( t . MakeImage ( ) ) ;
}
else
{
MemoryStream filedata = new MemoryStream ( file . Lumps [ lumpindex ] . Stream . ReadAllBytes ( ) ) ;
2016-03-04 08:10:56 +00:00
cachedparsers . Add ( fullpath , LoadTEXTURESSprites ( new TextResourceData ( this , filedata , "TEXTURES" , lumpindex , true ) , ref images ) ) ; //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
filedata . Dispose ( ) ;
}
2010-08-18 09:07:54 +00:00
// Find next
lumpindex = file . FindLumpIndex ( "TEXTURES" , lumpindex + 1 ) ;
}
// Return result
return images ;
}
// This loads the sprites definitions from a TEXTURES lump
2016-03-04 08:10:56 +00:00
public static TexturesParser LoadTEXTURESSprites ( TextResourceData data , ref List < ImageData > images )
2010-08-18 09:07:54 +00:00
{
// Parse the data
TexturesParser parser = new TexturesParser ( ) ;
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
if ( parser . HasError ) parser . LogError ( ) ; //mxd
2010-08-18 09:07:54 +00:00
2016-03-04 08:10:56 +00:00
// Make the sprites
2010-08-18 09:07:54 +00:00
foreach ( TextureStructure t in parser . Sprites )
{
2015-12-17 10:07:28 +00:00
// Add the sprite
2016-03-04 08:10:56 +00:00
images . Add ( t . MakeImage ( ) ) ;
2010-08-18 09:07:54 +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
if ( ! General . Map . Data . TextResources . ContainsKey ( parser . ScriptType ) )
General . Map . Data . TextResources [ parser . ScriptType ] = new HashSet < TextResource > ( ) ;
foreach ( KeyValuePair < string , TextResource > group in parser . TextResources )
General . Map . Data . TextResources [ parser . ScriptType ] . Add ( group . Value ) ;
return parser ; //mxd
2010-08-18 09:07:54 +00:00
}
2009-04-19 18:07:22 +00:00
// This finds and returns a sprite stream
2016-03-14 21:53:53 +00:00
public override Stream GetSpriteData ( string pname , ref string spritelocation )
2009-04-19 18:07:22 +00:00
{
// Error when suspended
if ( issuspended ) throw new Exception ( "Data reader is suspended" ) ;
// Find the lump in ranges
foreach ( LumpRange range in spriteranges )
{
2015-12-28 15:01:53 +00:00
Lump lump = file . FindLump ( pname , range . start , range . end ) ;
2016-03-14 21:53:53 +00:00
if ( lump ! = null )
{
spritelocation = location . GetDisplayName ( ) ; //mxd
return lump . Stream ;
}
2009-04-19 18:07:22 +00:00
}
return null ;
}
// This checks if the given sprite exists
public override bool GetSpriteExists ( string pname )
{
// Error when suspended
if ( issuspended ) throw new Exception ( "Data reader is suspended" ) ;
// Find the lump in ranges
foreach ( LumpRange range in spriteranges )
{
2015-12-28 15:01:53 +00:00
Lump lump = file . FindLump ( pname , range . start , range . end ) ;
2009-04-19 18:07:22 +00:00
if ( lump ! = null ) return true ;
}
return false ;
}
2016-04-08 14:02:08 +00:00
//mxd. Returns all sprites, which name starts with given string
public override HashSet < string > GetSpriteNames ( string startswith )
{
// Error when suspended
if ( issuspended ) throw new Exception ( "Data reader is suspended" ) ;
HashSet < string > result = new HashSet < string > ( ) ;
if ( startswith . Length > 8 ) return result ;
startswith = startswith . ToUpperInvariant ( ) ;
foreach ( LumpRange range in spriteranges )
{
for ( int i = range . start ; i < range . end + 1 ; i + + )
{
if ( file . Lumps [ i ] . Name . StartsWith ( startswith ) )
result . Add ( file . Lumps [ i ] . Name ) ;
}
}
return result ;
}
2009-04-19 18:07:22 +00:00
#endregion
2014-01-08 09:46:57 +00:00
#region = = = = = = = = = = = = = = = = = = Voxels ( mxd )
//mxd. This returns the list of voxels, which can be used without VOXELDEF definition
2015-12-18 10:16:53 +00:00
public override IEnumerable < string > GetVoxelNames ( )
2014-12-03 23:15:26 +00:00
{
2014-01-08 09:46:57 +00:00
// Error when suspended
if ( issuspended ) throw new Exception ( "Data reader is suspended" ) ;
List < string > voxels = new List < string > ( ) ;
Regex spriteName = new Regex ( SPRITE_NAME_PATTERN ) ;
2014-12-03 23:15:26 +00:00
foreach ( LumpRange range in voxelranges )
{
2014-01-08 09:46:57 +00:00
if ( range . start = = range . end ) continue ;
2014-12-03 23:15:26 +00:00
for ( int i = range . start + 1 ; i < range . end ; i + + )
{
2014-01-08 09:46:57 +00:00
if ( spriteName . IsMatch ( file . Lumps [ i ] . Name ) ) voxels . Add ( file . Lumps [ i ] . Name ) ;
}
}
return voxels . ToArray ( ) ;
}
//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
public override IEnumerable < TextResourceData > GetVoxeldefData ( )
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 ( issuspended ) throw new Exception ( "Data reader is suspended" ) ;
2016-04-23 23:15:43 +00:00
return GetAllLumps ( "VOXELDEF" ) ;
2014-01-08 09:46:57 +00:00
}
//mxd. This finds and returns a voxel stream or null if no voxel was found
2014-12-03 23:15:26 +00:00
public override Stream GetVoxelData ( string name )
{
2014-01-08 09:46:57 +00:00
// Error when suspended
if ( issuspended ) throw new Exception ( "Data reader is suspended" ) ;
2014-12-03 23:15:26 +00:00
foreach ( LumpRange range in voxelranges )
{
2014-01-08 09:46:57 +00:00
if ( range . start = = range . end ) continue ;
2015-12-28 15:01:53 +00:00
Lump lump = file . FindLump ( name , range . start , range . end ) ;
2014-01-08 09:46:57 +00:00
if ( lump ! = null ) return lump . Stream ;
}
return null ;
}
#endregion
2012-07-23 21:28:23 +00:00
#region = = = = = = = = = = = = = = = = = = Decorate , Gldefs , Mapinfo , etc . . .
2009-04-19 18:07:22 +00:00
2016-02-26 23:35:32 +00:00
// This finds and returns DECORATE streams
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 override IEnumerable < TextResourceData > GetDecorateData ( string pname )
2009-04-19 18:07:22 +00:00
{
if ( issuspended ) throw new Exception ( "Data reader is suspended" ) ;
2016-02-26 23:35:32 +00:00
List < TextResourceData > result = GetAllLumps ( pname ) ; //mxd
//mxd. Return ALL DECORATE lumps
if ( result . Count = = 0 | | string . Compare ( pname , "DECORATE" , StringComparison . OrdinalIgnoreCase ) = = 0 )
return result ;
//mxd. Return THE LAST include lump, because that's the way ZDoom seems to operate
return new List < TextResourceData > { result [ result . Count - 1 ] } ;
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
}
2014-02-26 14:11:06 +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. Should be only one entry per wad
public override IEnumerable < TextResourceData > GetMapinfoData ( )
{
if ( issuspended ) throw new Exception ( "Data reader is suspended" ) ;
2010-08-12 10:03:29 +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
// First look for ZMAPINFO
List < TextResourceData > result = new List < TextResourceData > ( ) ;
result . AddRange ( GetFirstLump ( "ZMAPINFO" ) ) ;
// Then for MAPINFO
if ( result . Count = = 0 ) result . AddRange ( GetFirstLump ( "MAPINFO" ) ) ;
2014-10-23 12:48:31 +00:00
return result ;
2009-04-19 18:07:22 +00:00
}
2012-06-01 10:17:47 +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
public override IEnumerable < TextResourceData > GetGldefsData ( GameType gametype )
2014-12-03 23:15:26 +00:00
{
2015-12-28 15:01:53 +00:00
if ( issuspended ) throw new Exception ( "Data reader is suspended" ) ;
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
List < TextResourceData > result = new List < TextResourceData > ( ) ;
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
// Try to load game specific GLDEFS first
if ( gametype ! = GameType . UNKNOWN )
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
string lumpname = Gldefs . GLDEFS_LUMPS_PER_GAME [ ( int ) gametype ] ;
2016-04-23 23:15:43 +00:00
result . AddRange ( GetAllLumps ( lumpname ) ) ;
2013-09-11 09:47:53 +00:00
}
2012-06-01 10:17:47 +00:00
2016-04-23 23:15:43 +00:00
// Can be many entries per wad
result . AddRange ( GetAllLumps ( "GLDEFS" ) ) ;
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 result ;
2013-09-11 09:47:53 +00:00
}
2012-06-01 10:17:47 +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
public override IEnumerable < TextResourceData > GetModeldefData ( )
2014-12-03 23:15:26 +00:00
{
2015-12-28 15:01:53 +00:00
if ( issuspended ) throw new Exception ( "Data reader is suspended" ) ;
2016-04-23 23:15:43 +00:00
return GetAllLumps ( "MODELDEF" ) ;
2013-09-11 09:47:53 +00:00
}
2012-06-01 10:17:47 +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
public override IEnumerable < TextResourceData > GetReverbsData ( )
2014-12-03 23:15:26 +00:00
{
2015-04-14 11:33:57 +00:00
if ( issuspended ) throw new Exception ( "Data reader is suspended" ) ;
2016-04-23 23:15:43 +00:00
return GetAllLumps ( "REVERBS" ) ;
2013-09-11 09:47:53 +00:00
}
2013-03-18 13:52:27 +00:00
2015-01-25 23:22:42 +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
public override IEnumerable < TextResourceData > GetSndSeqData ( )
2015-01-25 23:22:42 +00:00
{
if ( issuspended ) throw new Exception ( "Data reader is suspended" ) ;
2016-04-23 23:15:43 +00:00
return GetAllLumps ( "SNDSEQ" ) ;
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
}
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
public override IEnumerable < TextResourceData > GetAnimdefsData ( )
{
if ( issuspended ) throw new Exception ( "Data reader is suspended" ) ;
return GetAllLumps ( "ANIMDEFS" ) ;
2015-01-25 23:22:42 +00:00
}
2015-05-28 13:45:01 +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
public override IEnumerable < TextResourceData > GetTerrainData ( )
2015-05-28 13:45:01 +00:00
{
if ( 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
return GetAllLumps ( "TERRAIN" ) ;
}
2016-03-16 23:26:53 +00:00
//mxd
public override IEnumerable < TextResourceData > GetX11R6RGBData ( )
{
if ( issuspended ) throw new Exception ( "Data reader is suspended" ) ;
return GetAllLumps ( "X11R6RGB" ) ;
}
2016-04-13 14:11:35 +00:00
//mxd
public override IEnumerable < TextResourceData > GetCvarInfoData ( )
{
if ( issuspended ) throw new Exception ( "Data reader is suspended" ) ;
return GetAllLumps ( "CVARINFO" ) ;
}
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
private IEnumerable < TextResourceData > GetFirstLump ( string name )
{
List < TextResourceData > result = new List < TextResourceData > ( ) ;
int lumpindex = file . FindLumpIndex ( name ) ;
if ( lumpindex ! = - 1 )
result . Add ( new TextResourceData ( this , file . Lumps [ lumpindex ] . Stream , name , lumpindex , true ) ) ;
2015-05-28 13:45:01 +00:00
2015-12-18 10:16:53 +00:00
return result ;
}
//mxd
2016-02-26 23:35:32 +00:00
private List < TextResourceData > GetAllLumps ( string name )
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
List < TextResourceData > result = new List < TextResourceData > ( ) ;
// Find all lumps with given name
int lumpindex = file . FindLumpIndex ( name ) ;
while ( lumpindex > - 1 )
{
// Add to collection
result . Add ( new TextResourceData ( this , file . Lumps [ lumpindex ] . Stream , name , lumpindex , true ) ) ;
// Find next entry
lumpindex = file . FindLumpIndex ( name , lumpindex + 1 ) ;
}
2015-12-18 10:16:53 +00:00
2015-05-28 13:45:01 +00:00
return result ;
}
2013-09-11 09:47:53 +00:00
//mxd
2014-12-03 23:15:26 +00:00
internal override MemoryStream LoadFile ( string name )
{
2013-09-11 09:47:53 +00:00
Lump l = file . FindLump ( name ) ;
2013-03-18 13:52:27 +00:00
2015-12-28 15:01:53 +00:00
if ( l ! = null )
2014-12-03 23:15:26 +00:00
{
2013-09-11 09:47:53 +00:00
l . Stream . Seek ( 0 , SeekOrigin . Begin ) ;
return new MemoryStream ( l . Stream . ReadAllBytes ( ) ) ;
}
2013-03-18 13:52:27 +00:00
2013-09-11 09:47:53 +00:00
return null ;
}
2012-07-23 21:28:23 +00:00
2013-09-11 09:47:53 +00:00
//mxd
2014-12-03 23:15:26 +00:00
internal override bool FileExists ( string name )
{
2013-08-05 13:03:08 +00:00
return file . FindLumpIndex ( name ) ! = - 1 ;
2013-09-11 09:47:53 +00:00
}
2012-07-23 21:28:23 +00:00
2009-04-19 18:07:22 +00:00
#endregion
}
}