Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions game/server/player_lagcompensation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ struct LagRecord
m_flSimulationTime = -1;
m_masterSequence = 0;
m_masterCycle = 0;

for( int i=0; i<MAXSTUDIOPOSEPARAM; i++ )
{
m_flPoseParameters[i] = 0;
}
}

LagRecord( const LagRecord& src )
Expand All @@ -103,6 +108,11 @@ struct LagRecord
}
m_masterSequence = src.m_masterSequence;
m_masterCycle = src.m_masterCycle;

for( int i=0; i<MAXSTUDIOPOSEPARAM; i++ )
{
m_flPoseParameters[i] = src.m_flPoseParameters[i];
}
}

// Did player die this frame
Expand All @@ -120,6 +130,8 @@ struct LagRecord
LayerRecord m_layerRecords[MAX_LAYER_RECORDS];
int m_masterSequence;
float m_masterCycle;

float m_flPoseParameters[MAXSTUDIOPOSEPARAM];
};


Expand Down Expand Up @@ -326,6 +338,11 @@ void CLagCompensationManager::FrameUpdatePostEntityThink()
}
record.m_masterSequence = pPlayer->GetSequence();
record.m_masterCycle = pPlayer->GetCycle();

for( int i=0; i<MAXSTUDIOPOSEPARAM; i++ )
{
record.m_flPoseParameters[i] = pPlayer->GetPoseParameter(i);
}
}

//Clear the current player.
Expand Down Expand Up @@ -663,11 +680,23 @@ void CLagCompensationManager::BacktrackPlayer( CBasePlayer *pPlayer, float flTar
{
pPlayer->SetCycle( Lerp( frac, record->m_masterCycle, prevRecord->m_masterCycle ) );
}

for( int i=0; i<MAXSTUDIOPOSEPARAM; i++ )
{
//don't lerp pose params, just pick the closest
pPlayer->SetPoseParameter( i, record->m_flPoseParameters[i] );
//pAnimating->SetPoseParameter( i, Lerp( frac, record->m_flPoseParameters[i], prevRecord->m_flPoseParameters[i] ) );
}
}
if( !interpolatedMasters )
{
pPlayer->SetSequence(record->m_masterSequence);
pPlayer->SetCycle(record->m_masterCycle);

for( int i=0; i<MAXSTUDIOPOSEPARAM; i++ )
{
pPlayer->SetPoseParameter( i, record->m_flPoseParameters[i] );
}
}

////////////////////////
Expand Down Expand Up @@ -841,6 +870,11 @@ void CLagCompensationManager::FinishLagCompensation( CBasePlayer *player )
currentLayer->m_flWeight = restore->m_layerRecords[layerIndex].m_weight;
}
}

for( int i=0; i<MAXSTUDIOPOSEPARAM; i++ )
{
pPlayer->SetPoseParameter( i, restore->m_flPoseParameters[i] );
}
}

if ( restoreSimulationTime )
Expand Down
Loading