forked from StrafesNET/strafe-project
idle is special
This commit is contained in:
parent
52f7de809d
commit
d2002383cb
@ -10,9 +10,11 @@ pub enum Instruction{
|
||||
SetControl(SetControlInstruction),
|
||||
Mode(ModeInstruction),
|
||||
Misc(MiscInstruction),
|
||||
/// Idle: there were no input events, but the simulation is safe to advance to this timestep
|
||||
Idle,
|
||||
}
|
||||
impl Instruction{
|
||||
pub const IDLE:Self=Self::Misc(MiscInstruction::Idle);
|
||||
pub const IDLE:Self=Self::Idle;
|
||||
}
|
||||
#[derive(Clone,Debug)]
|
||||
pub enum MouseInstruction{
|
||||
@ -47,8 +49,6 @@ pub enum ModeInstruction{
|
||||
}
|
||||
#[derive(Clone,Debug)]
|
||||
pub enum MiscInstruction{
|
||||
/// Idle: there were no input events, but the simulation is safe to advance to this timestep
|
||||
Idle,
|
||||
PracticeFly,
|
||||
SetSensitivity(crate::integer::Ratio64Vec2),
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ pub(crate) enum Instruction{
|
||||
SetControl(SetControlInstruction),
|
||||
Mode(ModeInstruction),
|
||||
Misc(MiscInstruction),
|
||||
Idle,
|
||||
}
|
||||
#[derive(Clone,Debug)]
|
||||
enum UnbufferedInstruction{
|
||||
@ -38,6 +39,7 @@ pub(crate) enum NonMouseInstruction{
|
||||
SetControl(SetControlInstruction),
|
||||
Mode(ModeInstruction),
|
||||
Misc(MiscInstruction),
|
||||
Idle,
|
||||
}
|
||||
impl From<Instruction> for UnbufferedInstruction{
|
||||
#[inline]
|
||||
@ -47,6 +49,7 @@ impl From<Instruction> for UnbufferedInstruction{
|
||||
Instruction::SetControl(set_control_instruction)=>UnbufferedInstruction::NonMouse(NonMouseInstruction::SetControl(set_control_instruction)),
|
||||
Instruction::Mode(mode_instruction)=>UnbufferedInstruction::NonMouse(NonMouseInstruction::Mode(mode_instruction)),
|
||||
Instruction::Misc(misc_instruction)=>UnbufferedInstruction::NonMouse(NonMouseInstruction::Misc(misc_instruction)),
|
||||
Instruction::Idle=>UnbufferedInstruction::NonMouse(NonMouseInstruction::Idle),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -59,6 +62,7 @@ impl From<BufferedInstruction> for PhysicsInstruction{
|
||||
NonMouseInstruction::SetControl(set_control_instruction)=>PhysicsInstruction::SetControl(set_control_instruction),
|
||||
NonMouseInstruction::Mode(mode_instruction)=>PhysicsInstruction::Mode(mode_instruction),
|
||||
NonMouseInstruction::Misc(misc_instruction)=>PhysicsInstruction::Misc(misc_instruction),
|
||||
NonMouseInstruction::Idle=>PhysicsInstruction::Idle,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -1739,7 +1739,7 @@ fn atomic_input_instruction(state:&mut PhysicsState,data:&PhysicsData,ins:TimedI
|
||||
Instruction::Misc(MiscInstruction::SetSensitivity(..))
|
||||
|Instruction::Mode(_)
|
||||
|Instruction::SetControl(SetControlInstruction::SetZoom(..))
|
||||
|Instruction::Misc(MiscInstruction::Idle)=>false,
|
||||
|Instruction::Idle=>false,
|
||||
//these controls only update the body if you are on the ground
|
||||
Instruction::Mouse(_)
|
||||
|Instruction::SetControl(_)=>{
|
||||
@ -1837,7 +1837,7 @@ fn atomic_input_instruction(state:&mut PhysicsState,data:&PhysicsData,ins:TimedI
|
||||
}
|
||||
b_refresh_walk_target=false;
|
||||
},
|
||||
Instruction::Misc(MiscInstruction::Idle)=>{
|
||||
Instruction::Idle=>{
|
||||
//literally idle!
|
||||
b_refresh_walk_target=false;
|
||||
},
|
||||
|
@ -17,8 +17,6 @@ pub enum Instruction{
|
||||
ChangeMap(strafesnet_common::map::CompleteMap),
|
||||
}
|
||||
|
||||
const SESSION_INSTRUCTION_IDLE:SessionInstruction=SessionInstruction::Input(SessionInputInstruction::Misc(strafesnet_common::physics::MiscInstruction::Idle));
|
||||
|
||||
pub fn new<'a>(
|
||||
mut graphics_worker:crate::compat_worker::INWorker<'a,crate::graphics_worker::Instruction>,
|
||||
user_settings:crate::settings::UserSettings,
|
||||
@ -56,13 +54,13 @@ pub fn new<'a>(
|
||||
run_session_instruction!(ins.time,SessionInstruction::Playback(unbuffered_instruction));
|
||||
},
|
||||
Instruction::Render=>{
|
||||
run_session_instruction!(ins.time,SESSION_INSTRUCTION_IDLE);
|
||||
run_session_instruction!(ins.time,SessionInstruction::Idle);
|
||||
if let Some(frame_state)=session.get_frame_state(ins.time){
|
||||
run_graphics_worker_instruction!(GraphicsInstruction::Render(frame_state));
|
||||
}
|
||||
},
|
||||
Instruction::Resize(physical_size)=>{
|
||||
run_session_instruction!(ins.time,SESSION_INSTRUCTION_IDLE);
|
||||
run_session_instruction!(ins.time,SessionInstruction::Idle);
|
||||
let user_settings=session.user_settings().clone();
|
||||
run_graphics_worker_instruction!(GraphicsInstruction::Resize(physical_size,user_settings));
|
||||
},
|
||||
|
@ -21,6 +21,7 @@ pub enum Instruction<'a>{
|
||||
Control(SessionControlInstruction),
|
||||
Playback(SessionPlaybackInstruction),
|
||||
ChangeMap(&'a strafesnet_common::map::CompleteMap),
|
||||
Idle,
|
||||
}
|
||||
|
||||
pub enum SessionInputInstruction{
|
||||
@ -258,6 +259,9 @@ impl InstructionConsumer<Instruction<'_>> for Session{
|
||||
run_mouse_interpolator_instruction!(MouseInterpolatorInstruction::Misc(MiscInstruction::SetSensitivity(self.user_settings().calculate_sensitivity())));
|
||||
run_mouse_interpolator_instruction!(MouseInterpolatorInstruction::Mode(ModeInstruction::Spawn(ModeId::MAIN,StageId::FIRST)));
|
||||
},
|
||||
Instruction::Idle=>{
|
||||
run_mouse_interpolator_instruction!(MouseInterpolatorInstruction::Idle);
|
||||
}
|
||||
};
|
||||
|
||||
// process all emitted output instructions
|
||||
|
Loading…
x
Reference in New Issue
Block a user