2007-10-07 22:21:47 +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.Globalization;
|
|
|
|
using System.Text;
|
|
|
|
using System.Drawing;
|
|
|
|
using System.Drawing.Imaging;
|
|
|
|
using System.IO;
|
2009-03-01 18:34:37 +00:00
|
|
|
using CodeImp.DoomBuilder.Config;
|
2007-10-07 22:21:47 +00:00
|
|
|
using CodeImp.DoomBuilder.IO;
|
|
|
|
using CodeImp.DoomBuilder.Rendering;
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
namespace CodeImp.DoomBuilder.Data
|
|
|
|
{
|
2008-01-02 21:49:43 +00:00
|
|
|
internal abstract class DataReader
|
2007-10-07 22:21:47 +00:00
|
|
|
{
|
|
|
|
#region ================== Variables
|
|
|
|
|
|
|
|
protected DataLocation location;
|
|
|
|
protected bool issuspended = false;
|
|
|
|
protected bool isdisposed = false;
|
2009-03-01 18:34:37 +00:00
|
|
|
protected ResourceTextureSet textureset;
|
2007-10-07 22:21:47 +00:00
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Properties
|
|
|
|
|
|
|
|
public DataLocation Location { get { return location; } }
|
|
|
|
public bool IsDisposed { get { return isdisposed; } }
|
|
|
|
public bool IsSuspended { get { return issuspended; } }
|
2009-03-01 18:34:37 +00:00
|
|
|
public ResourceTextureSet TextureSet { get { return textureset; } }
|
2007-10-07 22:21:47 +00:00
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Constructor / Disposer
|
|
|
|
|
|
|
|
// Constructor
|
|
|
|
public DataReader(DataLocation dl)
|
|
|
|
{
|
|
|
|
// Keep information
|
|
|
|
location = dl;
|
2009-03-01 18:34:37 +00:00
|
|
|
textureset = new ResourceTextureSet(GetTitle(), dl.type);
|
2007-10-07 22:21:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Disposer
|
|
|
|
public virtual void Dispose()
|
|
|
|
{
|
|
|
|
// Not already disposed?
|
|
|
|
if(!isdisposed)
|
|
|
|
{
|
|
|
|
// Done
|
2009-03-01 18:34:37 +00:00
|
|
|
textureset = null;
|
2007-10-07 22:21:47 +00:00
|
|
|
isdisposed = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Management
|
|
|
|
|
2009-03-01 18:34:37 +00:00
|
|
|
// This returns a short name
|
|
|
|
public abstract string GetTitle();
|
|
|
|
|
2007-10-07 22:21:47 +00:00
|
|
|
// This suspends use of this resource
|
|
|
|
public virtual void Suspend()
|
|
|
|
{
|
|
|
|
issuspended = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// This resumes use of this resource
|
|
|
|
public virtual void Resume()
|
|
|
|
{
|
|
|
|
issuspended = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Palette
|
|
|
|
|
|
|
|
// When implemented, this should find and load a PLAYPAL palette
|
|
|
|
public virtual Playpal LoadPalette() { return null; }
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Textures
|
|
|
|
|
|
|
|
// When implemented, this should read the patch names
|
|
|
|
public virtual PatchNames LoadPatchNames() { return null; }
|
|
|
|
|
|
|
|
// When implemented, this returns the patch lump
|
|
|
|
public virtual Stream GetPatchData(string pname) { return null; }
|
|
|
|
|
2009-01-22 23:32:44 +00:00
|
|
|
// When implemented, this returns the texture lump
|
|
|
|
public virtual Stream GetTextureData(string pname) { return null; }
|
|
|
|
|
2007-10-07 22:21:47 +00:00
|
|
|
// When implemented, this loads the textures
|
|
|
|
public virtual ICollection<ImageData> LoadTextures(PatchNames pnames) { return null; }
|
|
|
|
|
|
|
|
#endregion
|
2007-10-26 13:17:20 +00:00
|
|
|
|
|
|
|
#region ================== Flats
|
|
|
|
|
|
|
|
// When implemented, this loads the flats
|
|
|
|
public virtual ICollection<ImageData> LoadFlats() { return null; }
|
|
|
|
|
|
|
|
// When implemented, this returns the flat lump
|
|
|
|
public virtual Stream GetFlatData(string pname) { return null; }
|
|
|
|
|
|
|
|
#endregion
|
2007-10-26 13:31:02 +00:00
|
|
|
|
|
|
|
#region ================== Sprites
|
2009-01-22 15:10:41 +00:00
|
|
|
|
2007-10-26 13:31:02 +00:00
|
|
|
// When implemented, this returns the sprite lump
|
|
|
|
public virtual Stream GetSpriteData(string pname) { return null; }
|
2009-01-22 15:10:41 +00:00
|
|
|
|
|
|
|
// When implemented, this checks if the given sprite lump exists
|
|
|
|
public virtual bool GetSpriteExists(string pname) { return false; }
|
2007-10-26 13:31:02 +00:00
|
|
|
|
|
|
|
#endregion
|
2009-01-20 22:54:41 +00:00
|
|
|
|
|
|
|
#region ================== Decorate
|
|
|
|
|
|
|
|
// When implemented, this returns the decorate lump
|
|
|
|
public virtual Stream GetDecorateData(string pname) { return null; }
|
|
|
|
|
|
|
|
#endregion
|
2007-10-07 22:21:47 +00:00
|
|
|
}
|
|
|
|
}
|