code style
This commit is contained in:
parent
4a7cd0a146
commit
7ade6129c7
@ -1046,9 +1046,9 @@ impl PhysicsContext{
|
||||
}
|
||||
|
||||
//tickless gaming
|
||||
pub fn run(&mut self, time_limit:Time){
|
||||
pub fn run(&mut self,time_limit:Time){
|
||||
//prepare is ommitted - everything is done via instructions.
|
||||
while let Some(instruction) = self.next_instruction(time_limit) {//collect
|
||||
while let Some(instruction)=self.next_instruction(time_limit){//collect
|
||||
//process
|
||||
self.process_instruction(instruction);
|
||||
//write hash lol
|
||||
@ -1339,12 +1339,12 @@ fn run_teleport_behaviour(wormhole:&Option<gameplay_attributes::Wormhole>,models
|
||||
match &general.trajectory{
|
||||
Some(trajectory)=>{
|
||||
match trajectory{
|
||||
gameplay_attributes::SetTrajectory::AirTime(_) => todo!(),
|
||||
gameplay_attributes::SetTrajectory::Height(_) => todo!(),
|
||||
gameplay_attributes::SetTrajectory::TargetPointTime { target_point: _, time: _ } => todo!(),
|
||||
gameplay_attributes::SetTrajectory::TargetPointSpeed { target_point: _, speed: _, trajectory_choice: _ } => todo!(),
|
||||
gameplay_attributes::SetTrajectory::AirTime(_)=>todo!(),
|
||||
gameplay_attributes::SetTrajectory::Height(_)=>todo!(),
|
||||
gameplay_attributes::SetTrajectory::TargetPointTime { target_point: _, time: _ }=>todo!(),
|
||||
gameplay_attributes::SetTrajectory::TargetPointSpeed { target_point: _, speed: _, trajectory_choice: _ }=>todo!(),
|
||||
&gameplay_attributes::SetTrajectory::Velocity(velocity)=>v=velocity,
|
||||
gameplay_attributes::SetTrajectory::DotVelocity { direction: _, dot: _ } => todo!(),
|
||||
gameplay_attributes::SetTrajectory::DotVelocity { direction: _, dot: _ }=>todo!(),
|
||||
}
|
||||
},
|
||||
None=>(),
|
||||
@ -1365,7 +1365,7 @@ fn run_teleport_behaviour(wormhole:&Option<gameplay_attributes::Wormhole>,models
|
||||
_=>panic!("invalid pair"),
|
||||
}
|
||||
},
|
||||
PhysicsInstruction::CollisionEnd(c) => {
|
||||
PhysicsInstruction::CollisionEnd(c)=>{
|
||||
match data.models.attr(c.convex_mesh_id().model_id){
|
||||
PhysicsCollisionAttributes::Contact{contacting:_,general:_}=>{
|
||||
state.touching.remove(&c);//remove contact before calling contact_constrain_acceleration
|
||||
@ -1377,7 +1377,7 @@ fn run_teleport_behaviour(wormhole:&Option<gameplay_attributes::Wormhole>,models
|
||||
},
|
||||
}
|
||||
},
|
||||
PhysicsInstruction::StrafeTick => {
|
||||
PhysicsInstruction::StrafeTick=>{
|
||||
let control_dir=state.style.get_control_dir(state.controls);
|
||||
if control_dir!=Planar64Vec3::ZERO{
|
||||
let camera_mat=state.camera.simulate_move_rotation_y(state.camera.mouse.lerp(&state.next_mouse,state.time).x);
|
||||
@ -1394,7 +1394,7 @@ fn run_teleport_behaviour(wormhole:&Option<gameplay_attributes::Wormhole>,models
|
||||
}
|
||||
}
|
||||
}
|
||||
PhysicsInstruction::ReachWalkTargetVelocity => {
|
||||
PhysicsInstruction::ReachWalkTargetVelocity=>{
|
||||
match &mut state.move_state{
|
||||
MoveState::Air|MoveState::Water=>(),
|
||||
MoveState::Walk(walk_state)|MoveState::Ladder(walk_state)=>{
|
||||
@ -1412,24 +1412,24 @@ fn run_teleport_behaviour(wormhole:&Option<gameplay_attributes::Wormhole>,models
|
||||
}
|
||||
}
|
||||
},
|
||||
PhysicsInstruction::Input(input_instruction) => {
|
||||
PhysicsInstruction::Input(input_instruction)=>{
|
||||
let mut b_refresh_walk_target=true;
|
||||
match input_instruction{
|
||||
PhysicsInputInstruction::SetNextMouse(m) => {
|
||||
PhysicsInputInstruction::SetNextMouse(m)=>{
|
||||
state.camera.move_mouse(state.next_mouse.pos);
|
||||
(state.camera.mouse,state.next_mouse)=(state.next_mouse.clone(),m);
|
||||
},
|
||||
PhysicsInputInstruction::ReplaceMouse(m0,m1) => {
|
||||
PhysicsInputInstruction::ReplaceMouse(m0,m1)=>{
|
||||
state.camera.move_mouse(m0.pos);
|
||||
(state.camera.mouse,state.next_mouse)=(m0,m1);
|
||||
},
|
||||
PhysicsInputInstruction::SetMoveForward(s) => state.set_control(StyleModifiers::CONTROL_MOVEFORWARD,s),
|
||||
PhysicsInputInstruction::SetMoveLeft(s) => state.set_control(StyleModifiers::CONTROL_MOVELEFT,s),
|
||||
PhysicsInputInstruction::SetMoveBack(s) => state.set_control(StyleModifiers::CONTROL_MOVEBACK,s),
|
||||
PhysicsInputInstruction::SetMoveRight(s) => state.set_control(StyleModifiers::CONTROL_MOVERIGHT,s),
|
||||
PhysicsInputInstruction::SetMoveUp(s) => state.set_control(StyleModifiers::CONTROL_MOVEUP,s),
|
||||
PhysicsInputInstruction::SetMoveDown(s) => state.set_control(StyleModifiers::CONTROL_MOVEDOWN,s),
|
||||
PhysicsInputInstruction::SetJump(s) => {
|
||||
PhysicsInputInstruction::SetMoveForward(s)=>state.set_control(StyleModifiers::CONTROL_MOVEFORWARD,s),
|
||||
PhysicsInputInstruction::SetMoveLeft(s)=>state.set_control(StyleModifiers::CONTROL_MOVELEFT,s),
|
||||
PhysicsInputInstruction::SetMoveBack(s)=>state.set_control(StyleModifiers::CONTROL_MOVEBACK,s),
|
||||
PhysicsInputInstruction::SetMoveRight(s)=>state.set_control(StyleModifiers::CONTROL_MOVERIGHT,s),
|
||||
PhysicsInputInstruction::SetMoveUp(s)=>state.set_control(StyleModifiers::CONTROL_MOVEUP,s),
|
||||
PhysicsInputInstruction::SetMoveDown(s)=>state.set_control(StyleModifiers::CONTROL_MOVEDOWN,s),
|
||||
PhysicsInputInstruction::SetJump(s)=>{
|
||||
state.set_control(StyleModifiers::CONTROL_JUMP,s);
|
||||
if let Some(walk_state)=get_walk_state(&state.move_state){
|
||||
let mut v=state.body.velocity;
|
||||
@ -1440,11 +1440,11 @@ fn run_teleport_behaviour(wormhole:&Option<gameplay_attributes::Wormhole>,models
|
||||
}
|
||||
b_refresh_walk_target=false;
|
||||
},
|
||||
PhysicsInputInstruction::SetZoom(s) => {
|
||||
PhysicsInputInstruction::SetZoom(s)=>{
|
||||
state.set_control(StyleModifiers::CONTROL_ZOOM,s);
|
||||
b_refresh_walk_target=false;
|
||||
},
|
||||
PhysicsInputInstruction::Reset => {
|
||||
PhysicsInputInstruction::Reset=>{
|
||||
//it matters which of these runs first, but I have not thought it through yet as it doesn't matter yet
|
||||
state.mode_state.clear();
|
||||
state.mode_state.set_stage_id(gameplay_modes::StageId::FIRST);
|
||||
@ -1457,7 +1457,7 @@ fn run_teleport_behaviour(wormhole:&Option<gameplay_attributes::Wormhole>,models
|
||||
(state.move_state,state.body.acceleration)=state.touching.get_move_state(&state.body,&data.models,&state.style,&data.hitbox_mesh,&state.camera,state.controls,&state.next_mouse,state.time);
|
||||
b_refresh_walk_target=false;
|
||||
},
|
||||
PhysicsInputInstruction::Idle => {b_refresh_walk_target=false;},//literally idle!
|
||||
PhysicsInputInstruction::Idle=>{b_refresh_walk_target=false;},//literally idle!
|
||||
}
|
||||
if b_refresh_walk_target{
|
||||
let a=refresh_walk_target(state,data);
|
||||
|
Loading…
Reference in New Issue
Block a user