game mechanics enums v1

This commit is contained in:
Quaternions 2023-10-02 22:45:20 -07:00
parent bb8c53aee2
commit b04a6d870a

View File

@ -257,28 +257,66 @@ fn get_control_dir(controls: u32) -> glam::Vec3{
return control_dir return control_dir
} }
pub struct PhysicsState { pub enum SetSpawnBehaviour{
pub body: Body, None,
pub hitbox_halfsize: glam::Vec3, Trigger,
pub contacts: std::collections::HashSet::<RelativeCollision>, Teleport,
//pub intersections: Vec<ModelId>, }
pub enum GameMechanicAttributes{
Platform{
spawn_id:u32,
},
SetSpawn{
spawn_id:u32,//which spawn to send to
force:bool,//allow setting to lower spawn id i.e. 7->3
behaviour:SetSpawnBehaviour
},
//Spawn(u32) NO! spawns are indexed in the map header instead of marked with attibutes
}
pub struct GameMechanicsState{
pub spawn_id:u32,
//jump_count:u32,
}
pub struct WorldState{
//all models
pub models:Vec<ModelPhysics>, pub models:Vec<ModelPhysics>,
//camera must exist in state because wormholes modify the camera, also camera punch //indexed list spawns[mode][spawn_id]=model_id
pub camera: Camera, pub spawns:Vec<Vec<u32>>,
pub mouse_interpolation: MouseInterpolationState, //the spawn point is where you spawn when you load into the map.
pub controls: u32, //This is not the same as Reset which teleports you to Spawn0
pub time: TIME, pub spawn_point:glam::Vec3,
pub strafe_tick_num: TIME, }
pub strafe_tick_den: TIME,
pub tick: u32, pub struct StyleModifiers{
pub keys_mask:u32,//keys which are unable to be activated
pub keys_held:u32,//keys which must be active to be able to strafe
pub mv:f32, pub mv:f32,
pub walk:WalkState, pub walk:WalkState,
pub walkspeed:f32, pub walkspeed:f32,
pub friction:f32, pub friction:f32,
pub walk_accel:f32, pub walk_accel:f32,
pub gravity:glam::Vec3, pub gravity:glam::Vec3,
pub strafe_tick_num:TIME,
pub strafe_tick_den:TIME,
pub hitbox_halfsize:glam::Vec3,
}
pub struct PhysicsState{
pub time:TIME,
pub body:Body,
pub world:WorldState,
pub game:GameMechanicsState,
pub style:StyleModifiers,
pub contacts:std::collections::HashSet::<RelativeCollision>,
//pub intersections: Vec<ModelId>,
//camera must exist in state because wormholes modify the camera, also camera punch
pub camera:Camera,
pub mouse_interpolation:MouseInterpolationState,
pub controls:u32,
pub grounded:bool, pub grounded:bool,
pub spawn_point: glam::Vec3,
} }
#[derive(Debug,Clone,Copy,Hash,Eq,PartialEq)] #[derive(Debug,Clone,Copy,Hash,Eq,PartialEq)]