Package net.mtrop.doom.map.data
Class HexenLinedef
java.lang.Object
net.mtrop.doom.map.data.HexenLinedef
- All Implemented Interfaces:
BinaryObject
Hexen/ZDoom 16-byte format implementation of Linedef.
- Author:
- Matthew Tropiano
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.mtrop.doom.object.BinaryObject
BinaryObject.InlineScanner<BO extends BinaryObject>, BinaryObject.Reflect, BinaryObject.Scanner<BO extends BinaryObject>, BinaryObject.Shared, BinaryObject.Transformer<BO extends BinaryObject>
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int[]
static final int
Special activation: monster walks over.static final String[]
static final int
Special activation: player bumps.static final int
Special activation: player walks over.static final int
Special activation: player uses.static final int
Special activation: player uses (with passthru).static final int
Special activation: projectile crosses.static final int
Special activation: projectile hits.protected int[]
Thing action special arguments.protected int
Behavior bitflags.static final int
Byte length of this object.protected int
Back sidedef.protected int
Front sidedef.protected int
Linedef special.protected int
Vertex end.protected int
Vertex start. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
Gets the activation type of this line.int
getArgument
(int n) Gets a special argument.int[]
Gets the special arguments copied into a new array.int
getFlags()
int
int
int
int
int
boolean
isFlagSet
(int flagType) Check's if a flag bit is set.void
readBytes
(InputStream in) Reads from anInputStream
and sets this object's fields.void
setActivationType
(int activationType) Sets the activation type of this line.void
setArguments
(int... arguments) Sets the special arguments.void
setFlag
(int flagType, boolean set) Sets/clears a bit flag.void
setFlags
(int flags) Sets/replaces this linedef's full bitflags.void
setSidedefBackIndex
(int sidedefBackIndex) Sets the back sidedef index.void
setSidedefFrontIndex
(int sidedefFrontIndex) Sets the front sidedef index.void
setSpecial
(int special) Sets the linedef special type.void
setVertexEndIndex
(int vertexEndIndex) Sets the ending vertex index.void
setVertexStartIndex
(int vertexStartIndex) Sets the starting vertex index.toString()
void
writeBytes
(OutputStream out) Writes this object to anOutputStream
.
-
Field Details
-
LENGTH
public static final int LENGTHByte length of this object.- See Also:
-
ACTIVATION_PLAYER_CROSSES
public static final int ACTIVATION_PLAYER_CROSSESSpecial activation: player walks over.- See Also:
-
ACTIVATION_PLAYER_USES
public static final int ACTIVATION_PLAYER_USESSpecial activation: player uses.- See Also:
-
ACTIVATION_MONSTER_CROSSES
public static final int ACTIVATION_MONSTER_CROSSESSpecial activation: monster walks over.- See Also:
-
ACTIVATION_PROJECTILE_HITS
public static final int ACTIVATION_PROJECTILE_HITSSpecial activation: projectile hits.- See Also:
-
ACTIVATION_PLAYER_BUMPS
public static final int ACTIVATION_PLAYER_BUMPSSpecial activation: player bumps.- See Also:
-
ACTIVATION_PROJECTILE_CROSSES
public static final int ACTIVATION_PROJECTILE_CROSSESSpecial activation: projectile crosses.- See Also:
-
ACTIVATION_PLAYER_USES_PASSTHRU
public static final int ACTIVATION_PLAYER_USES_PASSTHRUSpecial activation: player uses (with passthru).- See Also:
-
ACTIVATION_NAME
-
ACTIVATION_FLAGS
public static final int[] ACTIVATION_FLAGS -
arguments
protected int[] argumentsThing action special arguments. -
vertexStartIndex
protected int vertexStartIndexVertex start. -
vertexEndIndex
protected int vertexEndIndexVertex end. -
sidedefFrontIndex
protected int sidedefFrontIndexFront sidedef. -
sidedefBackIndex
protected int sidedefBackIndexBack sidedef. -
flags
protected int flagsBehavior bitflags. -
special
protected int specialLinedef special.
-
-
Constructor Details
-
HexenLinedef
public HexenLinedef()Creates a new linedef.
-
-
Method Details
-
getActivationType
public int getActivationType()Gets the activation type of this line.- Returns:
- the activation type of the line's special.
-
setActivationType
public void setActivationType(int activationType) Sets the activation type of this line. See theACTIVATION
constants.- Parameters:
activationType
- the new activation type of the line's special.- Throws:
IllegalArgumentException
- ifactivationType
is less than 0 or greater than 6.
-
setSpecial
public void setSpecial(int special) Sets the linedef special type.- Parameters:
special
- the new special number.- Throws:
IllegalArgumentException
- if special is outside the range 0 to 255.
-
setArguments
public void setArguments(int... arguments) Sets the special arguments.- Parameters:
arguments
- the arguments to set (5 maximum)- Throws:
IllegalArgumentException
- if length of arguments is greater than 5, or any argument is less than 0 or greater than 255.
-
getArguments
public int[] getArguments()Gets the special arguments copied into a new array.- Returns:
- gets the array of special arguments.
-
getArgument
public int getArgument(int n) Gets a special argument.- Parameters:
n
- the argument index (up to 4)- Returns:
- the argument value.
- Throws:
ArrayIndexOutOfBoundsException
- ifn
is less than 0 or greater than 4.
-
readBytes
Description copied from interface:BinaryObject
Reads from anInputStream
and sets this object's fields. Only reads the amount of bytes that it takes to read a single instance of the object. Note that not every object may have a consistent length!- Parameters:
in
- theInputStream
to read from.- Throws:
IOException
- if a read error occurs.
-
writeBytes
Description copied from interface:BinaryObject
Writes this object to anOutputStream
.- Parameters:
out
- theOutputStream
to write to.- Throws:
IOException
- if a write error occurs.
-
toString
-
setVertexStartIndex
public void setVertexStartIndex(int vertexStartIndex) Sets the starting vertex index.- Parameters:
vertexStartIndex
- the index of the start vertex.- Throws:
IllegalArgumentException
- if index is outside the range 0 to 65535.
-
getVertexStartIndex
public int getVertexStartIndex()- Returns:
- the starting vertex index.
-
setVertexEndIndex
public void setVertexEndIndex(int vertexEndIndex) Sets the ending vertex index.- Parameters:
vertexEndIndex
- the index of the end vertex.- Throws:
IllegalArgumentException
- if index is outside the range 0 to 65535.
-
getVertexEndIndex
public int getVertexEndIndex()- Returns:
- the ending vertex index.
-
setSidedefFrontIndex
public void setSidedefFrontIndex(int sidedefFrontIndex) Sets the front sidedef index.- Parameters:
sidedefFrontIndex
- the index of the front sidedef.- Throws:
IllegalArgumentException
- if special is outside the range -1 to 32767.
-
getSidedefFrontIndex
public int getSidedefFrontIndex()- Returns:
- the front sidedef index.
-
setSidedefBackIndex
public void setSidedefBackIndex(int sidedefBackIndex) Sets the back sidedef index.- Parameters:
sidedefBackIndex
- the index of the back sidedef.- Throws:
IllegalArgumentException
- if special is outside the range -1 to 32767.
-
getSidedefBackIndex
public int getSidedefBackIndex()- Returns:
- the back sidedef index.
-
getSpecial
public int getSpecial()- Returns:
- the linedef special type.
-
getFlags
public int getFlags()- Returns:
- this linedef's full bitflags.
-
setFlags
public void setFlags(int flags) Sets/replaces this linedef's full bitflags.- Parameters:
flags
- the flags to set
-
isFlagSet
public boolean isFlagSet(int flagType) Check's if a flag bit is set.- Parameters:
flagType
- the flag type (constant).- Returns:
- true if set, false if not.
- See Also:
-
setFlag
public void setFlag(int flagType, boolean set) Sets/clears a bit flag.- Parameters:
flagType
- the flag type (constant).set
- if true, set the bit. If false, clear it.- See Also:
-