Package net.mtrop.doom.util
Class MapUtils
java.lang.Object
net.mtrop.doom.util.MapUtils
Map utility methods and functions.
- Author:
- Matthew Tropiano
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
-
Method Summary
Modifier and TypeMethodDescriptionstatic BSPTree
createBSPTree
(Wad wad, String headerName) static DoomMap
createDoomMap
(Wad wad, int index) static DoomMap
createDoomMap
(Wad wad, String headerName) static HexenMap
createHexenMap
(Wad wad, int index) static HexenMap
createHexenMap
(Wad wad, String headerName) static UDMFMap
createUDMFMap
(Wad wad, int index) static UDMFMap
createUDMFMap
(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 int
getMapEntryCount
(Wad wad, int startIndex) Returns the amount of entries in a map, including the header.static int
getMapEntryCount
(Wad wad, String headerName) Returns the amount of entries in a map, including the header.static MapFormat
getMapFormat
(Wad wad, int index) Figures out a map's format by its entry listing.static MapFormat
getMapFormat
(Wad wad, String headerName) Figures out a map's format by its entry listing.static boolean
isMapDataLump
(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 aDoomMap
from an entry index in aWad
that 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 aWad
type that does not contain data.
-
createDoomMap
Creates aDoomMap
from 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 aWad
type that does not contain data.
-
createHexenMap
Creates aHexenMap
from an entry index in aWad
that 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 aWad
type that does not contain data.
-
createHexenMap
Creates aHexenMap
from 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 aWad
type that does not contain data.
-
createUDMFMap
Creates aUDMFMap
from an entry index in aWad
that 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 aWad
type that does not contain data.
-
createUDMFMap
Creates aUDMFMap
from 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 aWad
type that does not contain data.
-
createBSPTree
Creates aBSPTree
from 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 aWad
type 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
- theWad
to 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
Figures out a map's format by its entry listing.- Parameters:
wad
- the WAD to read from.index
- the index of the map header entry.- Returns:
- a
MapFormat
that details the map format type, or null if it cannot be figured out.
-
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
MapFormat
that details the map format type, or null if it cannot be figured out, nor if the header can be found.
-
getMapEntryCount
Returns the amount of entries in a map, including the header.- Parameters:
wad
- the WAD to inspect.headerName
- the map header name.- Returns:
- the length, in entries, of the contiguous map data.
-
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.
-