mirror of
https://github.com/ValveSoftware/source-sdk-2013.git
synced 2024-11-23 20:32:21 +00:00
Fixed not restoring pose parameters or checking if GetModelPtr is null
Shouldn't write code after staying up 24 hours
This commit is contained in:
parent
6bccd264eb
commit
4b6932ac4a
1 changed files with 34 additions and 13 deletions
|
@ -24,6 +24,7 @@
|
|||
#define LC_ANGLES_CHANGED (1<<9)
|
||||
#define LC_SIZE_CHANGED (1<<10)
|
||||
#define LC_ANIMATION_CHANGED (1<<11)
|
||||
#define LC_POSE_PARAMS_CHANGED (1<<12)
|
||||
|
||||
static ConVar sv_lagcompensation_teleport_dist( "sv_lagcompensation_teleport_dist", "64", FCVAR_DEVELOPMENTONLY | FCVAR_CHEAT, "How far a player got moved by game code before we can't lag compensate their position back" );
|
||||
#define LAG_COMPENSATION_EPS_SQR ( 0.1f * 0.1f )
|
||||
|
@ -322,11 +323,14 @@ void CLagCompensationManager::FrameUpdatePostEntityThink()
|
|||
record.m_masterCycle = pPlayer->GetCycle();
|
||||
|
||||
CStudioHdr *hdr = pPlayer->GetModelPtr();
|
||||
if( hdr )
|
||||
{
|
||||
for( int paramIndex = 0; paramIndex < hdr->GetNumPoseParameters(); paramIndex++ )
|
||||
{
|
||||
record.m_poseParameters[paramIndex] = pPlayer->GetPoseParameter( paramIndex );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Clear the current player.
|
||||
m_pCurrentPlayer = NULL;
|
||||
|
@ -723,6 +727,8 @@ void CLagCompensationManager::BacktrackPlayer( CBasePlayer *pPlayer, float flTar
|
|||
|
||||
// Now do pose parameters
|
||||
CStudioHdr *hdr = pPlayer->GetModelPtr();
|
||||
if( hdr )
|
||||
{
|
||||
for( int paramIndex = 0; paramIndex < hdr->GetNumPoseParameters(); paramIndex++ )
|
||||
{
|
||||
float poseParameter = record->m_poseParameters[paramIndex];
|
||||
|
@ -738,6 +744,7 @@ void CLagCompensationManager::BacktrackPlayer( CBasePlayer *pPlayer, float flTar
|
|||
pPlayer->SetPoseParameter( paramIndex, poseParameter );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( !flags )
|
||||
return; // we didn't change anything
|
||||
|
@ -861,6 +868,20 @@ void CLagCompensationManager::FinishLagCompensation( CBasePlayer *player )
|
|||
}
|
||||
}
|
||||
|
||||
if( restore->m_fFlags & LC_POSE_PARAMS_CHANGED )
|
||||
{
|
||||
restoreSimulationTime = true;
|
||||
|
||||
CStudioHdr *hdr = pPlayer->GetModelPtr();
|
||||
if( hdr )
|
||||
{
|
||||
for( int paramIndex = 0; paramIndex < hdr->GetNumPoseParameters(); paramIndex++ )
|
||||
{
|
||||
pPlayer->SetPoseParameter( paramIndex, restore->m_poseParameters[paramIndex] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( restoreSimulationTime )
|
||||
{
|
||||
pPlayer->SetSimulationTime( restore->m_flSimulationTime );
|
||||
|
|
Loading…
Reference in a new issue