mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-08 17:48:46 -10:00
Add files to partition interpolation code, base interpolation timing on Missiontime on remote instance vs. Mission time on the local instance.
46 lines
1.6 KiB
C++
46 lines
1.6 KiB
C++
#pragma once
|
|
|
|
#include "globalincs/pstypes.h"
|
|
#include "globalincs/systemvars.h"
|
|
#include "io/timer.h"
|
|
#include "math/vecmat.h"
|
|
#include <climits>
|
|
#include <array>
|
|
|
|
|
|
class multiplayer_timing_info {
|
|
private:
|
|
TIMESTAMP _start_time; // when did the multiplayer mission start
|
|
int _current_time; // time delta, how much time has passed since it started on the local instance?
|
|
int _last_time; // time delta, how much time passed, last frame? Useful when switching back from simulation mode to interpolation
|
|
int _skipped_time; // time delta, how much has time this instance has "skipped" because it is falling behind the server
|
|
// getting behind the server like that *should* be exceedingly rare, should always be 0 on server
|
|
|
|
int _proposed_skip_time; // until skip time is finalized, we need to
|
|
|
|
std::array<int, 12> _most_recent_frame;
|
|
|
|
// for in-game joiners, adjust local timing and then reset proposed time.
|
|
void finalize_skip_time() { _skipped_time += _proposed_skip_time; _proposed_skip_time = 0; }
|
|
|
|
public:
|
|
multiplayer_timing_info();
|
|
|
|
// aka reset the class. Needs to be called every time the mission starts.
|
|
void set_mission_start_time();
|
|
|
|
void update_current_time();
|
|
|
|
int get_current_time() { return _current_time; }
|
|
|
|
int get_last_time() { return _last_time; }
|
|
|
|
// push local time forward or back on clients based on received server times
|
|
// this will likely only ever be used for in-game joining, which is not ready.
|
|
//void set_proposed_skip_time(int candidate) { _proposed_skip_time = candidate; }
|
|
|
|
bool is_most_recent_frame(int player_index, int frame);
|
|
};
|
|
|
|
extern multiplayer_timing_info Multi_Timing_Info;
|