MapFormat

Serializes/deserializes XMF map data in SDLang format. Each layer can contain objects (eg. for marking events, clipping, or sprites if applicable), tilemapping (not for SpriteLayers), embedded data such as tilemapping or scripts, and so on. <br/> Note on layer tags: As of this version, additional tags within layers must have individual names. Subtags within a parent also need to have individual names. Namespaces are reserved for internal use (eg. file sources, objects).

class MapFormat {}

Constructors

this
this(string name, int resX, int resY)

Creates new instance from scratch.

this
this(F file)

Serializes itself from file.

Members

Functions

addEmbeddedMapData
void addEmbeddedMapData(int pri, ubyte[] base64Code)
void addEmbeddedMapData(int pri, MappingElement[] me)

Adds an embedded MapData to a TileLayer.

addEmbeddedPalette
Tag addEmbeddedPalette(Color[] c, string name, int offset)

Adds an embedded palette to the document.

addMapDataFile
void addMapDataFile(int pri, string filename, string dataPakSrc)

Adds a TileData file to a TileLayer. Filename must contain relative path.

addNewLayer
void addNewLayer(int pri, Tag t, Layer l)

Adds a layer from external tag.

addNewTileLayer
void addNewTileLayer(int pri, int tX, int tY, int mX, int mY, string name, TileLayer l)

Adds a new TileLayer to the document.

addPaletteFile
Tag addPaletteFile(string filename, string dataPakSrc, int offset, int palShift)

Adds a palette file source to the document.

addSingleTileInfo
void addSingleTileInfo(int pri, TileInfo item, string source, string dpkSource)

Adds a single TileInfo to a preexisting chunk on the layer.

addSingleTileInfo
void addSingleTileInfo(int pri, Tag t, string source)

Ditto, but from preexiting Tag.

addSubTagToLayersProperty
void addSubTagToLayersProperty(int pri, string name, string parent, T args)

Adds a new subtag to a layer's property tag.

addTagToLayer
void addTagToLayer(int pri, string name, T args)

Adds a new tag to a layer.

addTileInfo
void addTileInfo(int pri, TileInfo[] list, string source, string dpkSource)

Adds TileInfo to a TileLayer. Joins together multiple chunks with the same source identifier. (should be a path)

addTileInfo
void addTileInfo(int pri, Tag t, string source, string dpkSource)

Ditto, but from preexisting Tag.

addTileSourceFile
void addTileSourceFile(int pri, string filename, string dataPakSrc, int palShift)

Adds a tile source file to a TileLayer.

alterTileLayerInfo
void alterTileLayerInfo(int layerNum, int dataNum, T value)

Alters a tile layer data.

editLayerSubtagValues
Value[] editLayerSubtagValues(int pri, string name, string parent, T args)

Edits the values of a layer's subtag. Returns the original values in an array.

editLayerTagValues
Value[] editLayerTagValues(int pri, string name, T args)

Edits the values of a layer's tag. Returns the original values in an array.

getAllTileSources
Tag[] getAllTileSources(int pri)

Returns all tile sources for a given layer. Intended to use with a loader.

getHorizontalResolution
int getHorizontalResolution()

Returns the horizontal resolution.

getLayerInfo
LayerInfo[] getLayerInfo()

Returns all layer's basic information.

getLayerPropertyTagValues
Value[] getLayerPropertyTagValues(int pri, string name, string parent)

Gets the values of a layer's tag.

getLayerRootTagValues
Value[] getLayerRootTagValues(int pri)

Gets the values of a layer's root tag.

getLayerTagValues
Value[] getLayerTagValues(int pri, string name)

Gets the values of a layer's tag.

getMetadata
T getMetadata(string name)

Returns given metadata.

getName
string getName()

Returns the name of the map from metadata.

getTileInfo
TileInfo[] getTileInfo(int pri)

Returns a selected tile layer's all tile's basic information. Mainly used to display information in editors.

getTileSourceTag
Tag getTileSourceTag(int pri, string filename, string dataPakSrc)

Accesses tile source tags in documents for adding extra data (eg. tile names).

getVerticalResolution
int getVerticalResolution()

Returns the vertical resolution.

isPaletteFileExists
bool isPaletteFileExists(string filename, string dataPakSrc)

Returns whether the given palette file source exists.

loadMappingData
void loadMappingData()

Loads mapping data from disk to all layers.

loadTiles
void loadTiles(PaletteContainer paletteTarget)

Loads tiles from disk to all layers. Also loads the palette. TODO: Add dpk support

opIndex
Layer opIndex(int index)

Returns the requested layer

pullMapDataFromLayer
void pullMapDataFromLayer(int pri)

Pulls TileLayer data from the layer, and stores it in the preconfigured location. Only works with uncompressed data due to the need of recompression.

removeEmbeddedMapData
Tag removeEmbeddedMapData(int pri)

Removes embedded TileData from a TileLayer. Returns a backup for undoing.

removeLayer
Tag removeLayer(int pri)

Removes a given layer of any kind. Returns the Tag of the layer as a backup.

removeLayerTagValues
Tag removeLayerTagValues(int pri, string name)

Removes a layer's tag. Returns a backup for undoing.

removeMapDataFile
Tag removeMapDataFile(int pri)

Removes a TileData file from a TileLayer. Returns a backup for undoing.

removeTileInfo
Tag removeTileInfo(int pri, string source)

Removes a single tile from a TileInfo chunk. Returns a tag as a backup. Returns null if source is not found.

removeTileSourceFile
Tag removeTileSourceFile(int pri, string filename, string dataPakSrc)

Removes a tile source. Returns a backup copy.

save
void save(string path)

Saves the document to disc.

Static variables

renderingModeLookup
RenderingMode[string] renderingModeLookup;

Associative array used for rendering mode lookups in one way.

Variables

layerData
Tag[int] layerData;

Layerdata stored as SDLang tags.

layeroutput
Layer[int] layeroutput;

Used to fast map and object data pullback in editors

metadata
Tag metadata;

Stores metadata.

root
Tag root;

Root tag for common information.

tileDataFromExt
TileInfo[][int] tileDataFromExt;

Stores basic TileData that are loaded through extensions

Meta