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:
@@ -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,13 +1302,17 @@ 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)
|
||||||
{
|
{
|
||||||
//transform in-sub coordinates to outside coordinates
|
//transform in-sub coordinates to outside coordinates
|
||||||
if (character.MemLocalState[i].Position.Y > ConvertUnits.ToSimUnits(Level.Loaded.Size.Y))
|
if (character.MemLocalState[i].Position.Y > ConvertUnits.ToSimUnits(Level.Loaded.Size.Y))
|
||||||
character.MemLocalState[i].TransformInToOutside();
|
character.MemLocalState[i].TransformInToOutside();
|
||||||
}
|
}
|
||||||
else if (currentHull != null)
|
else if (currentHull != null)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user