fix timescale

This commit is contained in:
Quaternions 2025-01-17 21:47:02 -08:00
parent d49a6b2f0a
commit 75c8bc2bbb

View File

@ -286,11 +286,11 @@ impl InstructionConsumer<Instruction<'_>> for Session{
ViewState::Play=>{ ViewState::Play=>{
// allow simulation timescale for fun // allow simulation timescale for fun
let scale=self.simulation.timer.get_scale(); let scale=self.simulation.timer.get_scale();
self.simulation.timer.set_scale(ins.time,scale*5/4); self.simulation.timer.set_scale(ins.time,strafesnet_common::integer::Ratio64::new(scale.num()*5,scale.den()*4).unwrap());
}, },
ViewState::Replay(bot_id)=>if let Some(replay)=self.replays.get_mut(bot_id){ ViewState::Replay(bot_id)=>if let Some(replay)=self.replays.get_mut(bot_id){
let scale=replay.simulation.timer.get_scale(); let scale=replay.simulation.timer.get_scale();
replay.simulation.timer.set_scale(ins.time,scale*5/4); replay.simulation.timer.set_scale(ins.time,strafesnet_common::integer::Ratio64::new(scale.num()*5,scale.den()*4).unwrap());
}, },
} }
}, },
@ -299,11 +299,11 @@ impl InstructionConsumer<Instruction<'_>> for Session{
ViewState::Play=>{ ViewState::Play=>{
// allow simulation timescale for fun // allow simulation timescale for fun
let scale=self.simulation.timer.get_scale(); let scale=self.simulation.timer.get_scale();
self.simulation.timer.set_scale(ins.time,scale*4/5); self.simulation.timer.set_scale(ins.time,strafesnet_common::integer::Ratio64::new(scale.num()*4,scale.den()*5).unwrap());
}, },
ViewState::Replay(bot_id)=>if let Some(replay)=self.replays.get_mut(bot_id){ ViewState::Replay(bot_id)=>if let Some(replay)=self.replays.get_mut(bot_id){
let scale=replay.simulation.timer.get_scale(); let scale=replay.simulation.timer.get_scale();
replay.simulation.timer.set_scale(ins.time,scale*4/5); replay.simulation.timer.set_scale(ins.time,strafesnet_common::integer::Ratio64::new(scale.num()*4,scale.den()*5).unwrap());
}, },
} }
}, },