diff --git a/src/body.rs b/src/body.rs index 8e1bace..4cb1a68 100644 --- a/src/body.rs +++ b/src/body.rs @@ -257,34 +257,23 @@ fn get_control_dir(controls: u32) -> glam::Vec3{ return control_dir } -pub enum SetSpawnBehaviour{ - None, - Trigger, - Teleport, -} - -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, + //jump_counts:HashMap, +} + +pub struct StageDescription{ + pub start:u32,//start=model_id + pub spawns:Vec,//spawns[spawn_id]=model_id + pub ordered_checkpoints:Vec,//ordered_checkpoints[checkpoint_id]=model_id + pub unordered_checkpoints:Vec,//unordered_checkpoints[checkpoint_id]=model_id } pub struct WorldState{ //all models pub models:Vec, - //indexed list spawns[mode][spawn_id]=model_id - pub spawns:Vec>, + + pub stages:Vec, //the spawn point is where you spawn when you load into the map. //This is not the same as Reset which teleports you to Spawn0 pub spawn_point:glam::Vec3, @@ -432,6 +421,7 @@ pub struct ModelPhysics { //A model is a thing that has a hitbox. can be represented by a list of TreyMesh-es //in this iteration, all it needs is extents. mesh: TreyMesh, + attributes:crate::model::CollisionAttributes, } impl ModelPhysics { diff --git a/src/model.rs b/src/model.rs index 8dea948..f016c07 100644 --- a/src/model.rs +++ b/src/model.rs @@ -66,6 +66,79 @@ pub struct IndexedModelInstances{ pub spawn_point:glam::Vec3, } +//you have this effect while in contact +struct ContactingSurf{} +struct ContactingLadder{ + sticky:bool +} +//you have this effect while intersecting +struct IntersectingWater{ + viscosity:i64, + density:i64, +} +struct IntersectingAccelerator{ + acceleration:glam::I64Vec3 +} +//All models can be given these attributes +struct GameMechanicJumpLimit{ + count:u32, +} +struct GameMechanicBooster{ + velocity:glam::I64Vec3, +} +enum ZoneBehaviour{ + //Start is indexed + //Checkpoints are indexed + Finish, + Anitcheat, +} +struct GameMechanicZone{ + mode_id:u32, + behaviour:ZoneBehaviour +} +enum StageElementBehaviour{ + SpawnAt, + Trigger, + Teleport, + Platform, +} +struct GameMechanicStageElement{ + mode_id:u32, + stage_id:u32,//which spawn to send to + force:bool,//allow setting to lower spawn id i.e. 7->3 + behaviour:StageElementBehaviour +} +struct GameMechanicWormhole{//(position,angles)*=origin.transform.inverse()*destination.transform + model_id:u32, +} +struct GameMechanicAttributes{ + jump_limit:Option, + booster:Option, + zone:Option, + stage_element:Option, + wormhole:Option, +} +struct ContactingAttributes{ + surf:Option, + ladder:Option, +} +struct IntersectingAttibutes{ + water:Option, + accelerator:Option, +} +//Spawn(u32) NO! spawns are indexed in the map header instead of marked with attibutes +pub enum CollisionAttributes{ + Decoration,//visual only + Contact{//track whether you are contacting the object + contacting:ContactingAttributes, + general:GameMechanicAttributes, + }, + Intersect{//track whether you are intersecting the object + intersecting:IntersectingAttibutes, + general:GameMechanicAttributes, + }, +} + pub fn generate_indexed_model_list_from_obj(data:obj::ObjData,color:[f32;4]) -> Vec{ let mut unique_vertex_index = std::collections::HashMap::::new(); return data.objects.iter().map(|object|{