Skip to main content

Triggers

Struct Triggers 

Source
pub struct Triggers {
    pub tick: u64,
    events: Vec<Event>,
    busy: Vec<Busy>,
    rx_index: HashMap<u32, Vec<Obj>>,
    vertex_group: Vec<Vec<usize>>,
    frozen_slides: HashSet<usize>,
    pub notices: Vec<Notice>,
    pub carries: Vec<Carry>,
    xforms: HashMap<usize, Xform>,
    init_state: HashMap<usize, f64>,
    pub secrets_total: i32,
    pub secrets_found: i32,
}

Fields§

§tick: u64§events: Vec<Event>§busy: Vec<Busy>§rx_index: HashMap<u32, Vec<Obj>>§vertex_group: Vec<Vec<usize>>

Vertex groups: walls sharing a position (for moving shared vertices together).

§frozen_slides: HashSet<usize>

Slide sectors whose walls stay put: moving them would fold a sector over itself (E1M1’s coffin), which the original never shows.

§notices: Vec<Notice>§carries: Vec<Carry>

Sector movements since the game last consumed them (to carry the player).

§xforms: HashMap<usize, Xform>§init_state: HashMap<usize, f64>§secrets_total: i32§secrets_found: i32

Implementations§

Source§

impl Triggers

Source

pub fn new(world: &World) -> Self

Source

pub fn rebuild(&mut self, world: &World)

Recomputes lookup tables that are not saved (receive index, shared vertices).

Source

pub fn frozen_slides(&self) -> Vec<usize>

Slide sectors left in place because moving them would fold geometry.

Source

fn find_folding_slides(&self, world: &World) -> HashSet<usize>

Slide sectors whose full travel would make some sector polygon self-intersecting.

Source

pub fn reindex(&mut self, world: &World)

Source

pub fn init_level(&mut self, world: &mut World)

Initial pass after loading: apply start states and count secrets.

Source

pub fn post(&mut self, obj: Obj, cmd: u8, delay_ticks: u64)

Source

pub fn send(&mut self, world: &mut World, ch: u32, cmd: u8)

Broadcast cmd on channel ch.

Source

fn state_of(world: &World, o: Obj) -> Option<(u8, bool)>

Source

fn set_locked(world: &mut World, o: Obj, v: Option<bool>)

Source

pub fn trigger(&mut self, world: &mut World, o: Obj, c: u8)

Delivers a command to one object.

Source

fn busy_ticks(world: &World, o: Obj, target: u8) -> u32

Source

fn current_busy(world: &World, o: Obj) -> u32

Source

fn set_busy(world: &mut World, o: Obj, b: u32)

Source

fn set_state(&mut self, world: &mut World, o: Obj, target: u8)

Source

fn reach_state(&mut self, world: &mut World, o: Obj, st: u8)

Source

pub fn update(&mut self, world: &mut World)

Advances one 120 Hz tick.

Source

pub fn is_busy(&self, o: Obj) -> bool

Source

pub fn apply_sector(&mut self, world: &mut World, s: usize, f: f64)

Positions a moving sector for interpolation factor f (0 = off, 1 = on).

Source

fn apply_z(world: &mut World, s: usize, x: &XSector, f: f64)

Interpolates floor/ceiling between the x-sector’s off and on heights, carrying sprites that rest on the floor.

Source

fn moved_walls(world: &World, s: usize, marked: bool) -> Vec<(usize, i32)>

Source

fn initial_state(&mut self, world: &World, s: usize) -> f64

Source

fn carry(&mut self, world: &mut World, s: usize, new: Xform)

Moves sprites standing in a moving sector by the change from its previous transform, and records the change so the game can carry the player too.

Source

fn translate_sector( &mut self, world: &mut World, s: usize, dx: i32, dy: i32, marked: bool, )

Source

fn rotate_sector( &mut self, world: &mut World, s: usize, cx: i32, cy: i32, a: f64, marked: bool, )

Source

pub fn push_wall(&mut self, world: &mut World, w: usize) -> bool

Player pressed “use” on a wall (and possibly the sector behind it).

Source

pub fn push_sprite(&mut self, world: &mut World, s: usize) -> bool

Source

pub fn push_sector(&mut self, world: &mut World, s: usize) -> bool

Source

pub fn enter_sector(&mut self, world: &mut World, s: usize)

Source

pub fn exit_sector(&mut self, world: &mut World, s: usize)

Trait Implementations§

Source§

impl<'de> Deserialize<'de> for Triggers

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Triggers

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.