This commit is contained in:
Quaternions 2024-08-02 13:44:41 -07:00
parent 91b90675c4
commit cd65db0008
5 changed files with 47 additions and 1 deletions

View File

@ -1,7 +1,10 @@
mod common;
pub mod aabb;
pub mod model;
pub mod mouse;
pub mod integer;
pub mod physics;
pub mod instruction;
pub mod gameplay_modes;
pub mod gameplay_style;
pub mod gameplay_attributes;

View File

@ -1,10 +1,13 @@
use super::common::flag;
pub type ModeId=u32;
pub type StageId=u32;
#[binrw::binrw]
#[brw(little)]
pub struct StageElement{
pub header:u8,
pub stage_id:u32,
pub stage_id:StageId,
#[br(if(header&Self::JUMP_LIMIT!=0))]
pub jump_limit:Option<u8>,
}

View File

@ -0,0 +1,8 @@
use super::integer::Time;
#[binrw::binrw]
#[brw(little)]
pub struct TimedPhysicsInstruction{
pub time:Time,
pub instruction:super::physics::PhysicsInputInstruction,
}

8
src/newtypes/mouse.rs Normal file
View File

@ -0,0 +1,8 @@
use super::integer::Time;
#[binrw::binrw]
#[brw(little)]
pub struct MouseState{
pub pos:[i32;2],
pub time:Time,
}

24
src/newtypes/physics.rs Normal file
View File

@ -0,0 +1,24 @@
use super::common::Boolio;
#[binrw::binrw]
#[brw(little)]
pub enum PhysicsInputInstruction{
ReplaceMouse(super::mouse::MouseState,super::mouse::MouseState),
SetNextMouse(super::mouse::MouseState),
SetMoveRight(Boolio),
SetMoveUp(Boolio),
SetMoveBack(Boolio),
SetMoveLeft(Boolio),
SetMoveDown(Boolio),
SetMoveForward(Boolio),
SetJump(Boolio),
SetZoom(Boolio),
Restart,
Spawn(super::gameplay_modes::ModeId,super::gameplay_modes::StageId),
Idle,
//Idle: there were no input events, but the simulation is safe to advance to this timestep
//for interpolation / networking / playback reasons, most playback heads will always want
//to be 1 instruction ahead to generate the next state for interpolation.
PracticeFly,
SetSensitivity(super::integer::Ratio64Vec2),
}