compiles
This commit is contained in:
parent
f0721e682e
commit
d93763b4c1
@ -5,9 +5,9 @@ use crate::updatable::Updatable;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct StageElement{
|
||||
stage:StageId,//which stage spawn to send to
|
||||
force:bool,//allow setting to lower spawn id i.e. 7->3
|
||||
behaviour:StageElementBehaviour
|
||||
pub stage:StageId,//which stage spawn to send to
|
||||
pub force:bool,//allow setting to lower spawn id i.e. 7->3
|
||||
pub behaviour:StageElementBehaviour
|
||||
}
|
||||
impl StageElement{
|
||||
pub fn new(stage_id:u32,force:bool,behaviour:StageElementBehaviour)->Self{
|
||||
@ -121,6 +121,18 @@ impl Mode{
|
||||
pub fn get_spawn_model_id(&self,stage:StageId)->Option<ModelId>{
|
||||
self.stages.get(stage.0 as usize).map(|s|s.spawn)
|
||||
}
|
||||
pub fn get_zone(&self,model_id:ModelId)->Option<&Zone>{
|
||||
self.zones.get(&model_id)
|
||||
}
|
||||
pub fn get_stage(&self,stage_id:StageId)->Option<&Stage>{
|
||||
self.stages.get(stage_id.0 as usize)
|
||||
}
|
||||
pub fn get_element(&self,model_id:ModelId)->Option<&StageElement>{
|
||||
self.elements.get(&model_id)
|
||||
}
|
||||
pub fn get_jump_limit(&self,model_id:ModelId)->Option<u32>{
|
||||
self.jump_limit.get(&model_id).copied()
|
||||
}
|
||||
//TODO: put this in the SNF
|
||||
pub fn denormalize_data(&mut self){
|
||||
//expand and index normalized data
|
||||
|
@ -1,26 +1,26 @@
|
||||
use crate::integer::{Time,Ratio64,Planar64,Planar64Vec3};
|
||||
|
||||
pub struct StyleModifiers{
|
||||
controls_used:u32,//controls which are allowed to pass into gameplay
|
||||
controls_mask:u32,//controls which are masked from control state (e.g. jump in scroll style)
|
||||
strafe:Option<StrafeSettings>,
|
||||
jump_impulse:JumpImpulse,
|
||||
jump_calculation:JumpCalculation,
|
||||
static_friction:Planar64,
|
||||
kinetic_friction:Planar64,
|
||||
walk_speed:Planar64,
|
||||
walk_accel:Planar64,
|
||||
ladder_speed:Planar64,
|
||||
ladder_accel:Planar64,
|
||||
ladder_dot:Planar64,
|
||||
swim_speed:Planar64,
|
||||
mass:Planar64,
|
||||
mv:Planar64,
|
||||
surf_slope:Option<Planar64>,
|
||||
rocket_force:Option<Planar64>,
|
||||
gravity:Planar64Vec3,
|
||||
hitbox:Hitbox,
|
||||
camera_offset:Planar64Vec3,
|
||||
pub controls_used:u32,//controls which are allowed to pass into gameplay
|
||||
pub controls_mask:u32,//controls which are masked from control state (e.g. jump in scroll style)
|
||||
pub strafe:Option<StrafeSettings>,
|
||||
pub jump_impulse:JumpImpulse,
|
||||
pub jump_calculation:JumpCalculation,
|
||||
pub static_friction:Planar64,
|
||||
pub kinetic_friction:Planar64,
|
||||
pub walk_speed:Planar64,
|
||||
pub walk_accel:Planar64,
|
||||
pub ladder_speed:Planar64,
|
||||
pub ladder_accel:Planar64,
|
||||
pub ladder_dot:Planar64,
|
||||
pub swim_speed:Planar64,
|
||||
pub mass:Planar64,
|
||||
pub mv:Planar64,
|
||||
pub surf_slope:Option<Planar64>,
|
||||
pub rocket_force:Option<Planar64>,
|
||||
pub gravity:Planar64Vec3,
|
||||
pub hitbox:Hitbox,
|
||||
pub camera_offset:Planar64Vec3,
|
||||
}
|
||||
impl std::default::Default for StyleModifiers{
|
||||
fn default()->Self{
|
||||
@ -28,18 +28,18 @@ impl std::default::Default for StyleModifiers{
|
||||
}
|
||||
}
|
||||
impl StyleModifiers{
|
||||
const CONTROL_MOVEFORWARD:u32=0b00000001;
|
||||
const CONTROL_MOVEBACK:u32=0b00000010;
|
||||
const CONTROL_MOVERIGHT:u32=0b00000100;
|
||||
const CONTROL_MOVELEFT:u32=0b00001000;
|
||||
const CONTROL_MOVEUP:u32=0b00010000;
|
||||
const CONTROL_MOVEDOWN:u32=0b00100000;
|
||||
const CONTROL_JUMP:u32=0b01000000;
|
||||
const CONTROL_ZOOM:u32=0b10000000;
|
||||
pub const CONTROL_MOVEFORWARD:u32=0b00000001;
|
||||
pub const CONTROL_MOVEBACK:u32=0b00000010;
|
||||
pub const CONTROL_MOVERIGHT:u32=0b00000100;
|
||||
pub const CONTROL_MOVELEFT:u32=0b00001000;
|
||||
pub const CONTROL_MOVEUP:u32=0b00010000;
|
||||
pub const CONTROL_MOVEDOWN:u32=0b00100000;
|
||||
pub const CONTROL_JUMP:u32=0b01000000;
|
||||
pub const CONTROL_ZOOM:u32=0b10000000;
|
||||
|
||||
const RIGHT_DIR:Planar64Vec3=Planar64Vec3::X;
|
||||
const UP_DIR:Planar64Vec3=Planar64Vec3::Y;
|
||||
const FORWARD_DIR:Planar64Vec3=Planar64Vec3::NEG_Z;
|
||||
pub const RIGHT_DIR:Planar64Vec3=Planar64Vec3::X;
|
||||
pub const UP_DIR:Planar64Vec3=Planar64Vec3::Y;
|
||||
pub const FORWARD_DIR:Planar64Vec3=Planar64Vec3::NEG_Z;
|
||||
|
||||
fn neo()->Self{
|
||||
Self{
|
||||
@ -209,13 +209,13 @@ impl StyleModifiers{
|
||||
}
|
||||
}
|
||||
|
||||
enum JumpCalculation{
|
||||
pub enum JumpCalculation{
|
||||
Capped,//roblox
|
||||
Energy,//new
|
||||
Linear,//source
|
||||
}
|
||||
|
||||
enum JumpImpulse{
|
||||
pub enum JumpImpulse{
|
||||
FromTime(Time),//jump time is invariant across mass and gravity changes
|
||||
FromHeight(Planar64),//jump height is invariant across mass and gravity changes
|
||||
FromDeltaV(Planar64),//jump velocity is invariant across mass and gravity changes
|
||||
@ -226,20 +226,32 @@ enum JumpImpulse{
|
||||
//Energy means it adds energy
|
||||
//Linear means it linearly adds on
|
||||
|
||||
enum EnableStrafe{
|
||||
pub enum EnableStrafe{
|
||||
Always,
|
||||
MaskAny(u32),//hsw, shsw
|
||||
MaskAll(u32),
|
||||
//Function(Box<dyn Fn(u32)->bool>),
|
||||
}
|
||||
|
||||
struct StrafeSettings{
|
||||
pub struct StrafeSettings{
|
||||
enable:EnableStrafe,
|
||||
air_accel_limit:Option<Planar64>,
|
||||
tick_rate:Ratio64,
|
||||
}
|
||||
impl StrafeSettings{
|
||||
pub fn next_tick(&self,time:Time)->Time{
|
||||
Time::from_nanos(self.tick_rate.rhs_div_int(self.tick_rate.mul_int(time.nanos())+1))
|
||||
}
|
||||
pub fn mask(&self,controls:u32)->bool{
|
||||
match self.enable{
|
||||
EnableStrafe::Always=>true,
|
||||
EnableStrafe::MaskAny(mask)=>mask&controls!=0,
|
||||
EnableStrafe::MaskAll(mask)=>mask&controls==mask,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enum HitboxMesh{
|
||||
pub enum HitboxMesh{
|
||||
Box,//source
|
||||
Cylinder,//roblox
|
||||
//Sphere,//roblox old physics
|
||||
@ -248,9 +260,9 @@ enum HitboxMesh{
|
||||
//DualCone,
|
||||
}
|
||||
|
||||
struct Hitbox{
|
||||
halfsize:Planar64Vec3,
|
||||
mesh:HitboxMesh,
|
||||
pub struct Hitbox{
|
||||
pub halfsize:Planar64Vec3,
|
||||
pub mesh:HitboxMesh,
|
||||
}
|
||||
impl Hitbox{
|
||||
fn roblox()->Self{
|
||||
|
Loading…
x
Reference in New Issue
Block a user