Linedef Loading
Added the ability to load linedefs from a wad file. Also added functions to the linedef type to allow you to check the status of each bit of the flags value making it very easy to check linedef properties.
This commit is contained in:
47
src/doomlevel/linedef.rs
Normal file
47
src/doomlevel/linedef.rs
Normal file
@@ -0,0 +1,47 @@
|
||||
pub struct Linedef {
|
||||
pub start_vertex: i16,
|
||||
pub end_vertex: i16,
|
||||
pub flags: i16,
|
||||
pub special_type: i16,
|
||||
pub sector_tag: i16,
|
||||
pub front_sidedef: i16,
|
||||
pub back_sidedef: i16,
|
||||
}
|
||||
|
||||
impl Linedef {
|
||||
pub fn blocks_players(&self) -> bool {
|
||||
self.flags & (1 << 0) != 0
|
||||
}
|
||||
|
||||
pub fn blocks_monsters(&self) -> bool {
|
||||
self.flags & (1 << 1) != 0
|
||||
}
|
||||
|
||||
pub fn is_two_sided(&self) -> bool {
|
||||
self.flags & (1 << 2) != 0
|
||||
}
|
||||
|
||||
pub fn is_upper_unpegged(&self) -> bool {
|
||||
self.flags & (1 << 3) != 0
|
||||
}
|
||||
|
||||
pub fn is_lower_unpegged(&self) -> bool {
|
||||
self.flags & (1 << 4) != 0
|
||||
}
|
||||
|
||||
pub fn is_secret(&self) -> bool {
|
||||
self.flags & (1 << 5) != 0
|
||||
}
|
||||
|
||||
pub fn blocks_sound(&self) -> bool {
|
||||
self.flags & (1 << 6) != 0
|
||||
}
|
||||
|
||||
pub fn never_automap(&self) -> bool {
|
||||
self.flags & (1 << 7) != 0
|
||||
}
|
||||
|
||||
pub fn always_automap(&self) -> bool {
|
||||
self.flags & (1 << 8) != 0
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user