Renamed some stuff in lag compensation

This commit is contained in:
unknown 2024-09-02 03:53:23 +02:00
parent 2782633e53
commit 315f3c398c
3 changed files with 17 additions and 20 deletions

View file

@ -1979,8 +1979,7 @@ void C_BaseAnimating::StandardBlendingRules( CStudioHdr *hdr, Vector pos[], Quat
if ( m_pIk ) if ( m_pIk )
{ {
CIKContext auto_ik; CIKContext auto_ik;
m_iIKCounter++; auto_ik.Init( hdr, GetRenderAngles(), GetRenderOrigin(), currentTime, gpGlobals->framecount, boneMask );
auto_ik.Init( hdr, GetRenderAngles(), GetRenderOrigin(), currentTime, m_iIKCounter, boneMask );
boneSetup.CalcAutoplaySequences( pos, q, currentTime, &auto_ik ); boneSetup.CalcAutoplaySequences( pos, q, currentTime, &auto_ik );
} }
else else
@ -2930,8 +2929,7 @@ bool C_BaseAnimating::SetupBones( matrix3x4_t *pBoneToWorldOut, int nMaxBones, i
if (Teleported() || IsNoInterpolationFrame()) if (Teleported() || IsNoInterpolationFrame())
m_pIk->ClearTargets(); m_pIk->ClearTargets();
m_iIKCounter++; m_pIk->Init( hdr, GetRenderAngles(), GetRenderOrigin(), currentTime, gpGlobals->framecount, bonesMaskNeedRecalc );
m_pIk->Init( hdr, GetRenderAngles(), GetRenderOrigin(), currentTime, m_iIKCounter, bonesMaskNeedRecalc );
} }
// Let pose debugger know that we are blending // Let pose debugger know that we are blending

View file

@ -490,7 +490,6 @@ public:
int m_nHitboxSet; int m_nHitboxSet;
CSequenceTransitioner m_SequenceTransitioner; CSequenceTransitioner m_SequenceTransitioner;
int m_iIKCounter;
protected: protected:
CIKContext *m_pIk; CIKContext *m_pIk;

View file

@ -330,14 +330,14 @@ void CLagCompensationManager::TrackPlayerData( CBasePlayer* pPlayer )
if ( hdr ) if ( hdr )
{ {
for ( int paramIndex = 0; paramIndex < hdr->GetNumBoneControllers(); paramIndex++ ) for ( int boneIndex = 0; boneIndex < hdr->GetNumBoneControllers(); boneIndex++ )
{ {
record.m_encodedControllers[paramIndex] = pPlayer->GetBoneControllerArray()[paramIndex]; record.m_encodedControllers[boneIndex] = pPlayer->GetBoneControllerArray()[boneIndex];
} }
} }
#ifdef CSTRIKE_DLL #ifdef CSTRIKE_DLL
const auto csPlayer = dynamic_cast< CCSPlayer* >( pPlayer ); const auto csPlayer = ToCSPlayer( pPlayer );
if ( csPlayer ) if ( csPlayer )
{ {
@ -409,12 +409,12 @@ void CLagCompensationManager::BacktrackPlayer( CBasePlayer* pPlayer, CUserCmd* c
#ifdef CSTRIKE_DLL #ifdef CSTRIKE_DLL
QAngle renderAngles; QAngle renderAngles;
#endif #endif
LagRecord* nextRecordSim; LagRecord* prevRecordSim;
LagRecord* recordSim; LagRecord* recordSim;
LagRecord* recordAnim; LagRecord* recordAnim;
#ifdef CSTRIKE_DLL #ifdef CSTRIKE_DLL
auto csPlayer = dynamic_cast< CCSPlayer* >( pPlayer ); auto csPlayer = ToCSPlayer( pPlayer );
#endif #endif
int pl_index = pPlayer->entindex(); int pl_index = pPlayer->entindex();
@ -446,7 +446,7 @@ void CLagCompensationManager::BacktrackPlayer( CBasePlayer* pPlayer, CUserCmd* c
if ( recordSim->m_flSimulationTime < flTargetLerpSimTime ) if ( recordSim->m_flSimulationTime < flTargetLerpSimTime )
{ {
nextRecordSim = track->Get( i - 1 ); prevRecordSim = track->Get( i - 1 );
break; break;
} }
} }
@ -480,8 +480,8 @@ void CLagCompensationManager::BacktrackPlayer( CBasePlayer* pPlayer, CUserCmd* c
} }
float fracSim = 0.0f; float fracSim = 0.0f;
if ( nextRecordSim && ( recordSim->m_flSimulationTime < flTargetLerpSimTime ) if ( prevRecordSim && ( recordSim->m_flSimulationTime < flTargetLerpSimTime )
&& ( recordSim->m_flSimulationTime < nextRecordSim->m_flSimulationTime ) ) && ( recordSim->m_flSimulationTime < prevRecordSim->m_flSimulationTime ) )
{ {
// we didn't find the exact time but have a valid previous record // we didn't find the exact time but have a valid previous record
// so interpolate between these two records; // so interpolate between these two records;
@ -491,18 +491,18 @@ void CLagCompensationManager::BacktrackPlayer( CBasePlayer* pPlayer, CUserCmd* c
// calc fraction between both records // calc fraction between both records
fracSim = float( ( double( flTargetLerpSimTime ) - double( recordSim->m_flSimulationTime ) ) fracSim = float( ( double( flTargetLerpSimTime ) - double( recordSim->m_flSimulationTime ) )
/ ( double( nextRecordSim->m_flSimulationTime ) - double( recordSim->m_flSimulationTime ) ) ); / ( double( prevRecordSim->m_flSimulationTime ) - double( recordSim->m_flSimulationTime ) ) );
Assert( fracSim > 0 && fracSim < 1 ); // should never extrapolate Assert( fracSim > 0 && fracSim < 1 ); // should never extrapolate
ang = Lerp( fracSim, recordSim->m_vecAngles, nextRecordSim->m_vecAngles ); ang = Lerp( fracSim, recordSim->m_vecAngles, prevRecordSim->m_vecAngles );
org = Lerp( fracSim, recordSim->m_vecOrigin, nextRecordSim->m_vecOrigin ); org = Lerp( fracSim, recordSim->m_vecOrigin, prevRecordSim->m_vecOrigin );
minsPreScaled = Lerp( fracSim, recordSim->m_vecMinsPreScaled, nextRecordSim->m_vecMinsPreScaled ); minsPreScaled = Lerp( fracSim, recordSim->m_vecMinsPreScaled, prevRecordSim->m_vecMinsPreScaled );
maxsPreScaled = Lerp( fracSim, recordSim->m_vecMaxsPreScaled, nextRecordSim->m_vecMaxsPreScaled ); maxsPreScaled = Lerp( fracSim, recordSim->m_vecMaxsPreScaled, prevRecordSim->m_vecMaxsPreScaled );
#ifdef CSTRIKE_DLL #ifdef CSTRIKE_DLL
if ( csPlayer ) if ( csPlayer )
{ {
renderAngles = Lerp( fracSim, recordSim->m_angRenderAngles, nextRecordSim->m_angRenderAngles ); renderAngles = Lerp( fracSim, recordSim->m_angRenderAngles, prevRecordSim->m_angRenderAngles );
} }
#endif #endif
} }
@ -681,7 +681,7 @@ void CLagCompensationManager::FinishLagCompensation( CBasePlayer* player )
LagRecord* change = &m_ChangeData[i]; LagRecord* change = &m_ChangeData[i];
#ifdef CSTRIKE_DLL #ifdef CSTRIKE_DLL
auto csPlayer = dynamic_cast< CCSPlayer* >( pPlayer ); auto csPlayer = ToCSPlayer( pPlayer );
if ( csPlayer ) if ( csPlayer )
{ {