Compare commits
No commits in common. "06ca80a52951575b851b1af7bc97269c8bca7a10" and "5b1f840e4023613084d706131c4895168a5fc1e4" have entirely different histories.
06ca80a529
...
5b1f840e40
@ -248,7 +248,6 @@ pub struct Game {
|
|||||||
|
|
||||||
pub replay_recorder: Option<Gd<ReplayRecorder>>,
|
pub replay_recorder: Option<Gd<ReplayRecorder>>,
|
||||||
pub current_replay_playback: Option<Gd<ReplayPlayback>>,
|
pub current_replay_playback: Option<Gd<ReplayPlayback>>,
|
||||||
pub last_replay_clone: f64,
|
|
||||||
|
|
||||||
base: Base<Node>,
|
base: Base<Node>,
|
||||||
}
|
}
|
||||||
@ -337,11 +336,7 @@ impl INode for Game {
|
|||||||
if let Some(playback) = &mut self.current_replay_playback
|
if let Some(playback) = &mut self.current_replay_playback
|
||||||
&& let Some(recorder) = &self.replay_recorder
|
&& let Some(recorder) = &self.replay_recorder
|
||||||
{
|
{
|
||||||
self.last_replay_clone += delta;
|
|
||||||
if self.last_replay_clone >= 1. {
|
|
||||||
playback.bind_mut().replay = recorder.bind().replay.clone();
|
playback.bind_mut().replay = recorder.bind().replay.clone();
|
||||||
self.last_replay_clone = 0.
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -43,7 +43,7 @@ impl StandaloneReplayManager {
|
|||||||
if let Some(mut file) = FileAccess::open(path, ModeFlags::READ) {
|
if let Some(mut file) = FileAccess::open(path, ModeFlags::READ) {
|
||||||
let mut bytes = Vec::new();
|
let mut bytes = Vec::new();
|
||||||
while !file.eof_reached() {
|
while !file.eof_reached() {
|
||||||
bytes.extend(file.get_buffer(1_000_000).to_vec());
|
bytes.push(file.get_8());
|
||||||
}
|
}
|
||||||
|
|
||||||
let bytes = Cursor::new(&mut bytes);
|
let bytes = Cursor::new(&mut bytes);
|
||||||
@ -351,7 +351,9 @@ impl ReplayRecorder {
|
|||||||
let mut buf = Vec::new();
|
let mut buf = Vec::new();
|
||||||
let cursor = Cursor::new(&mut buf);
|
let cursor = Cursor::new(&mut buf);
|
||||||
ciborium::into_writer(&self.replay, cursor).ok();
|
ciborium::into_writer(&self.replay, cursor).ok();
|
||||||
file.store_buffer(&PackedArray::from_iter(buf));
|
for byte in buf {
|
||||||
|
file.store_8(byte);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user