11 Commits

Author SHA1 Message Date
fee06aea0f fly in style 2024-02-21 22:42:37 -08:00
edf5278e37 debug 2024-02-21 04:12:35 -08:00
43a4237c17 why these not const 2024-02-21 02:59:20 -08:00
c44e5dad96 remove unimplemented JumpCalculation 2024-02-21 02:34:40 -08:00
1c45e9a821 wip accel code 2024-02-21 00:32:15 -08:00
3f62b9b353 integer edits 2024-02-20 22:28:51 -08:00
59348f8cbe walk edits 2024-02-20 22:28:39 -08:00
d292993c16 jumped velocity 2024-02-16 21:16:44 -08:00
12907fa4a9 const things and code moves 2024-02-16 21:16:44 -08:00
73cd6b74fc redesign StyleModifiers 2024-02-16 21:16:44 -08:00
1ca1169697 fix jump limit 2024-02-16 21:16:44 -08:00
5 changed files with 39 additions and 30 deletions

7
Cargo.lock generated
View File

@@ -17,8 +17,7 @@ checksum = "151665d9be52f9bb40fc7966565d39666f2d1e69233571b71b87791c7e0528b3"
[[package]]
name = "id"
version = "0.1.0"
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
checksum = "2337e7a6c273082b672e377e159d7a168fb51438461b7c4033c79a515dd7a25a"
source = "git+https://git.itzana.me/Quaternions/id?rev=1f710976cc786c8853dab73d6e1cee53158deeb0#1f710976cc786c8853dab73d6e1cee53158deeb0"
dependencies = [
"proc-macro2",
"quote",
@@ -54,9 +53,9 @@ dependencies = [
[[package]]
name = "syn"
version = "2.0.52"
version = "2.0.48"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b699d15b36d1f02c3e7c69f8ffef53de37aefae075d8488d4ba1a7788d574a07"
checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f"
dependencies = [
"proc-macro2",
"quote",

View File

@@ -8,4 +8,4 @@ edition = "2021"
[dependencies]
bitflags = "2.4.2"
glam = "0.25.0"
id = { version = "0.1.0", registry = "strafesnet" }
id = { git = "https://git.itzana.me/Quaternions/id", rev = "1f710976cc786c8853dab73d6e1cee53158deeb0" }

View File

@@ -3,33 +3,41 @@ const VALVE_SCALE:Planar64=Planar64::raw(1<<28);// 1/16
use crate::integer::{Time,Ratio64,Planar64,Planar64Vec3};
use crate::controls_bitflag::Controls;
#[derive(Clone,Debug)]
pub enum Continuity{
FirstDegree(FlySettings),
SecondDegree{
//strafing
strafe:Option<StrafeSettings>,
//player gets a controllable rocket force
rocket:Option<PropulsionSettings>,
//flying
//jumping is allowed
jump:Option<JumpSettings>,
//standing & walking is allowed
walk:Option<WalkSettings>,
//laddering is allowed
ladder:Option<LadderSettings>,
//water propulsion
swim:Option<PropulsionSettings>,
//maximum slope before sloped surfaces become frictionless
gravity:Planar64Vec3,
//unused
mass:Planar64,
}
}
#[derive(Clone,Debug)]
pub struct StyleModifiers{
//controls which are allowed to pass into gameplay (usually all)
pub controls_mask:Controls,
//controls which are masked from control state (e.g. !jump in scroll style)
pub controls_mask_state:Controls,
//strafing
pub strafe:Option<StrafeSettings>,
//player gets a controllable rocket force
pub rocket:Option<PropulsionSettings>,
//flying
//jumping is allowed
pub jump:Option<JumpSettings>,
//standing & walking is allowed
pub walk:Option<WalkSettings>,
//laddering is allowed
pub ladder:Option<LadderSettings>,
//water propulsion
pub swim:Option<PropulsionSettings>,
//maximum slope before sloped surfaces become frictionless
pub gravity:Planar64Vec3,
pub continuity:Continuity,
//hitbox
pub hitbox:Hitbox,
//camera location relative to the center (0,0,0) of the hitbox
pub camera_offset:Planar64Vec3,
//unused
pub mass:Planar64,
}
impl std::default::Default for StyleModifiers{
fn default()->Self{
@@ -37,6 +45,12 @@ impl std::default::Default for StyleModifiers{
}
}
#[derive(Clone,Debug)]
pub struct FlySettings{
speed:Planar64,
clip:bool,//noclip
}
#[derive(Clone,Debug)]
pub enum JumpCalculation{
Capped,//roblox

View File

@@ -824,9 +824,9 @@ impl std::ops::Div<i64> for Planar64Vec3{
///[-1.0,1.0] = [-2^32,2^32]
#[derive(Clone,Copy,Hash,Eq,PartialEq)]
pub struct Planar64Mat3{
pub x_axis:Planar64Vec3,
pub y_axis:Planar64Vec3,
pub z_axis:Planar64Vec3,
x_axis:Planar64Vec3,
y_axis:Planar64Vec3,
z_axis:Planar64Vec3,
}
impl Default for Planar64Mat3{
#[inline]

View File

@@ -27,7 +27,6 @@ pub trait PolygonIter{
pub trait MapVertexId{
fn map_vertex_id<F:Fn(VertexId)->VertexId>(self,f:F)->Self;
}
#[derive(Clone)]
pub struct PolygonList(Vec<IndexedVertexList>);
impl PolygonList{
pub const fn new(list:Vec<IndexedVertexList>)->Self{
@@ -55,7 +54,6 @@ impl MapVertexId for PolygonList{
// }
#[derive(Clone,Copy,Hash,id::Id,PartialEq,Eq)]
pub struct PolygonGroupId(u32);
#[derive(Clone)]
pub enum PolygonGroup{
PolygonList(PolygonList),
//TriangleStrip(TriangleStrip),
@@ -91,13 +89,12 @@ impl RenderConfig{
}
}
}
#[derive(Clone)]
pub struct IndexedGraphicsGroup{
//Render pattern material/texture/shader/flat color
pub render:RenderConfigId,
pub groups:Vec<PolygonGroupId>,
}
#[derive(Clone,Default)]
#[derive(Default)]
pub struct IndexedPhysicsGroup{
//the polygons in this group are guaranteed to make a closed convex shape
pub groups:Vec<PolygonGroupId>,
@@ -105,7 +102,6 @@ pub struct IndexedPhysicsGroup{
//This is a superset of PhysicsModel and GraphicsModel
#[derive(Clone,Copy,Hash,id::Id,Eq,PartialEq)]
pub struct MeshId(u32);
#[derive(Clone)]
pub struct Mesh{
pub unique_pos:Vec<Planar64Vec3>,//Unit32Vec3
pub unique_normal:Vec<Planar64Vec3>,//Unit32Vec3