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