MemStates without a timestamp are removed from a character when using timestamp-based interpolation (there may still be ID-based states with a timestamp of 0.0 in the buffer when switching to timestamp-based interpolation, for example when the controlled character dies)

+ vice versa when switching from timestamp-based to ID-based
This commit is contained in:
Regalis
2017-04-04 21:32:53 +03:00
parent 0f8e6440ef
commit 8215c4d91b
@@ -1252,6 +1252,10 @@ namespace Barotrauma
if (character != GameMain.NetworkMember.Character || !character.AllowInput) if (character != GameMain.NetworkMember.Character || !character.AllowInput)
{ {
//remove states without a timestamp (there may still be ID-based states
//in the list when the controlled character switches to timestamp-based interpolation)
character.MemState.RemoveAll(m => m.Timestamp == 0.0f);
//use simple interpolation for other players' characters and characters that can't move //use simple interpolation for other players' characters and characters that can't move
if (character.MemState.Count > 0) if (character.MemState.Count > 0)
{ {
@@ -1298,6 +1302,10 @@ namespace Barotrauma
} }
else else
{ {
//remove states with a timestamp (there may still timestamp-based states
//in the list if the controlled character switches from timestamp-based interpolation to ID-based)
character.MemState.RemoveAll(m => m.Timestamp > 0.0f);
for (int i = 0; i < character.MemLocalState.Count; i++) for (int i = 0; i < character.MemLocalState.Count; i++)
{ {
if (character.Submarine == null) if (character.Submarine == null)