Package net.mtrop.doom.map.data
Class Reject
java.lang.Object
net.mtrop.doom.map.data.Reject
- All Implemented Interfaces:
BinaryObject
Represents the Reject lump.
The reject lump is a lookup grid that hold information on what sectors can "see" other sectors on the map used for thing sight algorithms.
- 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>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
getSectorIsVisibleTo
(int sectorIndex, int targetSectorIndex) Checks whether a sector is visible from another.void
readBytes
(InputStream in) Reads from anInputStream
and sets this object's fields.void
setSectorIsVisibleTo
(int sectorIndex, int targetSectorIndex, boolean flag) Sets whether a sector is visible from another.void
writeBytes
(OutputStream out) Writes this object to anOutputStream
.
-
Constructor Details
-
Reject
public Reject(int sectors) Creates a new blank reject grid.- Parameters:
sectors
- the number of sectors.
-
-
Method Details
-
getSectorIsVisibleTo
public boolean getSectorIsVisibleTo(int sectorIndex, int targetSectorIndex) Checks whether a sector is visible from another.- Parameters:
sectorIndex
- the sector index viewing from.targetSectorIndex
- the sector index viewing into.- Returns:
- true if so, false if not.
-
setSectorIsVisibleTo
public void setSectorIsVisibleTo(int sectorIndex, int targetSectorIndex, boolean flag) Sets whether a sector is visible from another.- Parameters:
sectorIndex
- the sector index viewing from.targetSectorIndex
- the sector index viewing into.flag
- true if visible, false if not.
-
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!- Specified by:
readBytes
in interfaceBinaryObject
- Parameters:
in
- theInputStream
to read from.- Throws:
IOException
- if a read error occurs.
-
writeBytes
Description copied from interface:BinaryObject
Writes this object to anOutputStream
.- Specified by:
writeBytes
in interfaceBinaryObject
- Parameters:
out
- theOutputStream
to write to.- Throws:
IOException
- if a write error occurs.
-