add dynamics correction messages

This commit is contained in:
Roman Trapeznikov 2024-01-08 17:29:43 +03:00
parent 5bd7e05773
commit 13ad00029c
No known key found for this signature in database
GPG Key ID: 7F4F4115DE048582
2 changed files with 7 additions and 0 deletions

View File

@ -139,6 +139,9 @@ void ClientSessionReplay::FetchMessages() {
SessionStream out(nullptr, false);
DumpFullState(&out);
current_state_.correction_messages_.clear();
GetCorrectionMessages(false, &current_state_.correction_messages_);
fflush(file_);
current_state_.file_position_ = ftell(file_);
current_state_.message_ = out.GetOutMessage();
@ -301,6 +304,9 @@ void ClientSessionReplay::RestoreFromCurrentState() {
Reset(true);
fseek(file_, current_state_.file_position_, SEEK_SET);
HandleSessionMessage(current_state_.message_);
for (const auto& msg : current_state_.correction_messages_) {
HandleSessionMessage(msg);
}
}
} // namespace ballistica::scene_v1

View File

@ -35,6 +35,7 @@ class ClientSessionReplay : public ClientSession,
struct IntermediateState {
// Message containing full scene state at the moment.
std::vector<uint8_t> message_;
std::vector<std::vector<uint8_t>> correction_messages_;
// A position in replay file where we should continue from.
long file_position_;