Class MapUtils
java.lang.Object
net.mtrop.doom.util.MapUtils
Map utility methods and functions.
- Author:
- Matthew Tropiano
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String -
Method Summary
Modifier and TypeMethodDescriptionstatic BSPTreecreateBSPTree(Wad wad, String headerName) static DoomMapcreateDoomMap(Wad wad, int index) static DoomMapcreateDoomMap(Wad wad, String headerName) static HexenMapcreateHexenMap(Wad wad, int index) static HexenMapcreateHexenMap(Wad wad, String headerName) static UDMFMapcreateUDMFMap(Wad wad, int index) static UDMFMapcreateUDMFMap(Wad wad, String headerName) static String[]getAllMapHeaders(Wad wad) Returns all of the entry names of every map in the wad.static int[]getAllMapIndices(Wad wad) Returns all of the indices of every map in the wad.static WadEntry[]getMapEntries(Wad wad, int startIndex) Returns the entries in a map, including the header.static WadEntry[]getMapEntries(Wad wad, String header) Returns the entries in a map, including the header, if the map is found.static intgetMapEntryCount(Wad wad, int startIndex) Returns the amount of entries in a map, including the header.static intgetMapEntryCount(Wad wad, String headerName) Returns the amount of entries in a map, including the header.static MapFormatgetMapFormat(Wad wad, int index) Figures out a map's format by its entry listing.static MapFormatgetMapFormat(Wad wad, String headerName) Figures out a map's format by its entry listing.static booleanisMapDataLump(String name) Tests if the entry name provided is a valid part of a map.
-
Field Details
-
LUMP_THINGS
- See Also:
-
LUMP_SECTORS
- See Also:
-
LUMP_VERTICES
- See Also:
-
LUMP_SIDEDEFS
- See Also:
-
LUMP_LINEDEFS
- See Also:
-
LUMP_TEXTMAP
- See Also:
-
LUMP_SSECTORS
- See Also:
-
LUMP_NODES
- See Also:
-
LUMP_SEGS
- See Also:
-
LUMP_REJECT
- See Also:
-
LUMP_BLOCKMAP
- See Also:
-
LUMP_ZNODES
- See Also:
-
LUMP_GL_VERT
- See Also:
-
LUMP_GL_SEGS
- See Also:
-
LUMP_GL_SSECT
- See Also:
-
LUMP_GL_NODES
- See Also:
-
LUMP_GL_PVS
- See Also:
-
LUMP_BEHAVIOR
- See Also:
-
LUMP_SCRIPTS
- See Also:
-
LUMP_DIALOGUE
- See Also:
-
LUMP_PWADINFO
- See Also:
-
LUMP_ENDMAP
- See Also:
-
MAP_SPECIAL
-
-
Method Details
-
createDoomMap
Creates aDoomMapfrom an entry index in aWadthat denotes a map header. If there is more than one header in the WAD that matches the provided header, the last one is found.- Parameters:
wad- the WAD to read from.index- the index of the map header entry.- Returns:
- a DoomMap with all objects set.
- Throws:
MapException- if map information is incomplete, or can't be found.IOException- if the WAD can't be read from.UnsupportedOperationException- if attempting to read from aWadtype that does not contain data.
-
createDoomMap
Creates aDoomMapfrom a starting entry in aWad. If there is more than one header in the WAD that matches the provided header, the last one is found.- Parameters:
wad- the WAD to read from.headerName- the map header name to search for.- Returns:
- a DoomMap with all objects set.
- Throws:
MapException- if map information is incomplete, or can't be found.IOException- if the WAD can't be read from.UnsupportedOperationException- if attempting to read from aWadtype that does not contain data.
-
createHexenMap
Creates aHexenMapfrom an entry index in aWadthat denotes a map header. If there is more than one header in the WAD that matches the provided header, the last one is found.- Parameters:
wad- the WAD to read from.index- the index of the map header entry.- Returns:
- a HexenMap with all objects set.
- Throws:
MapException- if map information is incomplete, or can't be found.IOException- if the WAD can't be read from.UnsupportedOperationException- if attempting to read from aWadtype that does not contain data.
-
createHexenMap
Creates aHexenMapfrom a starting entry in aWad. If there is more than one header in the WAD that matches the provided header, the last one is found.- Parameters:
wad- the WAD to read from.headerName- the map header name to search for.- Returns:
- a HexenMap with all objects set.
- Throws:
MapException- if map information is incomplete, or can't be found.IOException- if the WAD can't be read from.UnsupportedOperationException- if attempting to read from aWadtype that does not contain data.
-
createUDMFMap
Creates aUDMFMapfrom an entry index in aWadthat denotes a map header. If there is more than one header in the WAD that matches the provided header, the last one is found.- Parameters:
wad- the WAD to read from.index- the index of the map header entry.- Returns:
- a UDMFMap with all objects set.
- Throws:
MapException- if map information is incomplete, or can't be found.IOException- if the WAD can't be read from.UnsupportedOperationException- if attempting to read from aWadtype that does not contain data.
-
createUDMFMap
Creates aUDMFMapfrom a starting entry in aWad. If there is more than one header in the WAD that matches the provided header, the last one is found.- Parameters:
wad- the WAD to read from.headerName- the map header name to search for.- Returns:
- a UDMFMap with all objects set.
- Throws:
MapException- if map information is incomplete, or can't be found.IOException- if the WAD can't be read from.UnsupportedOperationException- if attempting to read from aWadtype that does not contain data.
-
createBSPTree
Creates aBSPTreefrom a starting map entry in aWad. If there is more than one header in the WAD that matches the provided header, the last one is found.- Parameters:
wad- the WAD to read from.headerName- the map header name to search for.- Returns:
- a BSPTree with all objects set.
- Throws:
MapException- if map information is incomplete, or can't be found.IOException- if the WAD can't be read from.UnsupportedOperationException- if attempting to read from aWadtype that does not contain data.
-
getAllMapIndices
Returns all of the indices of every map in the wad. This algorithm scans for map entry names. If it finds one, the previous entry is the probably the header. This algorithm is not perfect, and may return false positives in case some outlying entries are named the same as some map entries.- Parameters:
wad- theWadto search inside.- Returns:
- an array of all of the entry indices of maps.
-
getAllMapHeaders
Returns all of the entry names of every map in the wad. This algorithm scans for map entry names. If it finds one, the previous entry is the probably the header.- Parameters:
wad- the Wad to search in.- Returns:
- an array of all of the entry indices of maps.
-
getMapFormat
-
getMapFormat
Figures out a map's format by its entry listing.- Parameters:
wad- the WAD to read from.headerName- the map header name to search for.- Returns:
- a
MapFormatthat details the map format type, or null if it cannot be figured out, nor if the header can be found.
-
getMapEntryCount
-
getMapEntryCount
Returns the amount of entries in a map, including the header.- Parameters:
wad- the WAD to inspect.startIndex- the starting index.- Returns:
- the length, in entries, of the contiguous map data.
-
getMapEntries
Returns the entries in a map, including the header. The entry at the index is assumed to be the header.- Parameters:
wad- the WAD to inspect.startIndex- the starting index.- Returns:
- the list of map entries for the map data.
- Since:
- 2.1.0
-
getMapEntries
Returns the entries in a map, including the header, if the map is found. If there is more than one header in the WAD that matches the provided header, the last one is found.- Parameters:
wad- the WAD to inspect.header- the starting entry name to find.- Returns:
- the list of map entries for the map data, or an empty array if the map header is not found.
- Since:
- 2.1.0
-
isMapDataLump
Tests if the entry name provided is a valid part of a map.- Parameters:
name- the lump name to test.- Returns:
- if this is the name of a map data lump.
-