We might prefer to set to local instead to lag compensate
This commit is contained in:
parent
d40a479e85
commit
d8598a8d22
6 changed files with 46 additions and 46 deletions
|
@ -2179,8 +2179,8 @@ void C_CSPlayer::FireGameEvent( IGameEvent* event )
|
|||
float flBackupBoneControllers[MAXSTUDIOBONECTRLS];
|
||||
|
||||
C_AnimationLayer backupAnimLayers[C_BaseAnimatingOverlay::MAX_OVERLAYS];
|
||||
Vector vecBackupPosition = player->GetAbsOrigin();
|
||||
QAngle angBackupAngles = player->GetAbsAngles();
|
||||
Vector vecBackupPosition = player->GetLocalOrigin();
|
||||
QAngle angBackupAngles = player->GetLocalAngles();
|
||||
auto flOldCycle = player->GetCycle();
|
||||
auto iOldSequence = player->GetSequence();
|
||||
|
||||
|
@ -2201,13 +2201,13 @@ void C_CSPlayer::FireGameEvent( IGameEvent* event )
|
|||
|
||||
player->m_nSequence = event->GetInt( "sequence" );
|
||||
player->m_flCycle = event->GetFloat( "cycle" );
|
||||
player->SetAbsOrigin( Vector( event->GetFloat( "position_x" ),
|
||||
event->GetFloat( "position_y" ),
|
||||
event->GetFloat( "position_z" ) ) );
|
||||
player->SetLocalOrigin( Vector( event->GetFloat( "position_x" ),
|
||||
event->GetFloat( "position_y" ),
|
||||
event->GetFloat( "position_z" ) ) );
|
||||
|
||||
player->SetAbsAngles( QAngle( event->GetFloat( "angle_x" ),
|
||||
event->GetFloat( "angle_y" ),
|
||||
event->GetFloat( "angle_z" ) ) );
|
||||
player->SetLocalAngles( QAngle( event->GetFloat( "angle_x" ),
|
||||
event->GetFloat( "angle_y" ),
|
||||
event->GetFloat( "angle_z" ) ) );
|
||||
|
||||
const auto numposeparams = event->GetInt( "num_poseparams" );
|
||||
Assert( numposeparams == player->GetModelPtr()->GetNumPoseParameters() );
|
||||
|
@ -2273,7 +2273,7 @@ void C_CSPlayer::FireGameEvent( IGameEvent* event )
|
|||
// Let's check what went wrong.
|
||||
int pos = 0;
|
||||
|
||||
auto newOrigin = player->GetAbsOrigin();
|
||||
auto newOrigin = player->GetLocalOrigin();
|
||||
auto simtime = event->GetFloat( "simtime" );
|
||||
auto animtime = event->GetFloat( "animtime" );
|
||||
|
||||
|
@ -2282,7 +2282,7 @@ void C_CSPlayer::FireGameEvent( IGameEvent* event )
|
|||
char buffer[256];
|
||||
V_sprintf_safe( buffer, "simtime: %f != %f", simtime, pRecord->m_flSimulationTime );
|
||||
|
||||
NDebugOverlay::EntityTextAtPosition( pRecord->m_vecAbsOrigin, pos, buffer, flDuration );
|
||||
NDebugOverlay::EntityTextAtPosition( pRecord->m_vecLocalOrigin, pos, buffer, flDuration );
|
||||
pos++;
|
||||
}
|
||||
|
||||
|
@ -2291,41 +2291,41 @@ void C_CSPlayer::FireGameEvent( IGameEvent* event )
|
|||
char buffer[256];
|
||||
V_sprintf_safe( buffer, "animtime: %f != %f", animtime, pRecord->m_flAnimTime );
|
||||
|
||||
NDebugOverlay::EntityTextAtPosition( pRecord->m_vecAbsOrigin, pos, buffer, flDuration );
|
||||
NDebugOverlay::EntityTextAtPosition( pRecord->m_vecLocalOrigin, pos, buffer, flDuration );
|
||||
pos++;
|
||||
}
|
||||
|
||||
if ( pRecord->m_vecAbsOrigin != newOrigin )
|
||||
if ( pRecord->m_vecLocalOrigin != newOrigin )
|
||||
{
|
||||
char buffer[256];
|
||||
V_sprintf_safe( buffer,
|
||||
"pos: %f != %f, %f != %f, %f != %f",
|
||||
newOrigin.x,
|
||||
pRecord->m_vecAbsOrigin.x,
|
||||
pRecord->m_vecLocalOrigin.x,
|
||||
newOrigin.y,
|
||||
pRecord->m_vecAbsOrigin.y,
|
||||
pRecord->m_vecLocalOrigin.y,
|
||||
newOrigin.z,
|
||||
pRecord->m_vecAbsOrigin.z );
|
||||
pRecord->m_vecLocalOrigin.z );
|
||||
|
||||
NDebugOverlay::EntityTextAtPosition( pRecord->m_vecAbsOrigin, pos, buffer, flDuration );
|
||||
NDebugOverlay::EntityTextAtPosition( pRecord->m_vecLocalOrigin, pos, buffer, flDuration );
|
||||
pos++;
|
||||
}
|
||||
|
||||
auto angles = player->GetAbsAngles();
|
||||
auto angles = player->GetLocalAngles();
|
||||
|
||||
if ( pRecord->m_angAbsRotation != angles )
|
||||
if ( pRecord->m_angLocalAngles != angles )
|
||||
{
|
||||
char buffer[256];
|
||||
V_sprintf_safe( buffer,
|
||||
"angles: %f != %f, %f != %f, %f != %f",
|
||||
angles.x,
|
||||
pRecord->m_angAbsRotation.x,
|
||||
pRecord->m_angLocalAngles.x,
|
||||
angles.y,
|
||||
pRecord->m_angAbsRotation.y,
|
||||
pRecord->m_angLocalAngles.y,
|
||||
angles.z,
|
||||
pRecord->m_angAbsRotation.z );
|
||||
pRecord->m_angLocalAngles.z );
|
||||
|
||||
NDebugOverlay::EntityTextAtPosition( pRecord->m_vecAbsOrigin, pos, buffer, flDuration );
|
||||
NDebugOverlay::EntityTextAtPosition( pRecord->m_vecLocalOrigin, pos, buffer, flDuration );
|
||||
pos++;
|
||||
}
|
||||
|
||||
|
@ -2334,7 +2334,7 @@ void C_CSPlayer::FireGameEvent( IGameEvent* event )
|
|||
char buffer[256];
|
||||
V_sprintf_safe( buffer, "cycle: %f != %f", player->m_flCycle, pRecord->m_flCycle );
|
||||
|
||||
NDebugOverlay::EntityTextAtPosition( pRecord->m_vecAbsOrigin, pos, buffer, flDuration );
|
||||
NDebugOverlay::EntityTextAtPosition( pRecord->m_vecLocalOrigin, pos, buffer, flDuration );
|
||||
pos++;
|
||||
}
|
||||
|
||||
|
@ -2348,7 +2348,7 @@ void C_CSPlayer::FireGameEvent( IGameEvent* event )
|
|||
player->GetSequenceName( pRecord->m_nSequence ),
|
||||
pRecord->m_nSequence );
|
||||
|
||||
NDebugOverlay::EntityTextAtPosition( pRecord->m_vecAbsOrigin, pos, buffer, flDuration );
|
||||
NDebugOverlay::EntityTextAtPosition( pRecord->m_vecLocalOrigin, pos, buffer, flDuration );
|
||||
pos++;
|
||||
}
|
||||
|
||||
|
@ -2366,7 +2366,7 @@ void C_CSPlayer::FireGameEvent( IGameEvent* event )
|
|||
player->m_flPoseParameter[i],
|
||||
pRecord->m_flPoseParameters[i] );
|
||||
|
||||
NDebugOverlay::EntityTextAtPosition( pRecord->m_vecAbsOrigin, pos, buffer, flDuration );
|
||||
NDebugOverlay::EntityTextAtPosition( pRecord->m_vecLocalOrigin, pos, buffer, flDuration );
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
|
@ -2383,7 +2383,7 @@ void C_CSPlayer::FireGameEvent( IGameEvent* event )
|
|||
player->m_flEncodedController[i],
|
||||
pRecord->m_flEncodedControllers[i] );
|
||||
|
||||
NDebugOverlay::EntityTextAtPosition( pRecord->m_vecAbsOrigin, pos, buffer, flDuration );
|
||||
NDebugOverlay::EntityTextAtPosition( pRecord->m_vecLocalOrigin, pos, buffer, flDuration );
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
|
@ -2416,7 +2416,7 @@ void C_CSPlayer::FireGameEvent( IGameEvent* event )
|
|||
animOverlay->m_fFlags,
|
||||
pRecord->m_AnimationLayer[i].m_fFlags );
|
||||
|
||||
NDebugOverlay::EntityTextAtPosition( pRecord->m_vecAbsOrigin, pos, buffer, flDuration );
|
||||
NDebugOverlay::EntityTextAtPosition( pRecord->m_vecLocalOrigin, pos, buffer, flDuration );
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
|
@ -2439,8 +2439,8 @@ void C_CSPlayer::FireGameEvent( IGameEvent* event )
|
|||
// Set back original stuff.
|
||||
player->m_nSequence = iOldSequence;
|
||||
player->m_flCycle = flOldCycle;
|
||||
player->SetAbsOrigin( vecBackupPosition );
|
||||
player->SetAbsAngles( angBackupAngles );
|
||||
player->SetLocalOrigin( vecBackupPosition );
|
||||
player->SetLocalAngles( angBackupAngles );
|
||||
|
||||
for ( int i = 0; i < MAXSTUDIOPOSEPARAM; i++ )
|
||||
{
|
||||
|
|
|
@ -408,8 +408,8 @@ private:
|
|||
struct HitboxRecord
|
||||
{
|
||||
int m_nAttackerTickBase;
|
||||
Vector m_vecAbsOrigin;
|
||||
QAngle m_angAbsRotation;
|
||||
Vector m_vecLocalOrigin;
|
||||
QAngle m_angLocalAngles;
|
||||
float m_flSimulationTime;
|
||||
int m_nSequence;
|
||||
float m_flCycle;
|
||||
|
|
|
@ -1584,7 +1584,7 @@ void CCSPlayer::PostThink()
|
|||
m_PlayerAnimState->Update( m_angEyeAngles[YAW], m_angEyeAngles[PITCH] );
|
||||
|
||||
// Use the m_angRotation instead.
|
||||
SetAbsAngles( m_PlayerAnimState->GetRenderAngles() );
|
||||
SetLocalAngles( m_PlayerAnimState->GetRenderAngles() );
|
||||
|
||||
// check if we need to apply a deafness DSP effect.
|
||||
if ((m_applyDeafnessTime != 0.0f) && (m_applyDeafnessTime <= gpGlobals->curtime))
|
||||
|
|
|
@ -172,8 +172,8 @@ void CLagCompensationManager::TrackEntities()
|
|||
record.m_fFlags = LC_NONE;
|
||||
record.m_flSimulationTime = pEntity->GetSimulationTime();
|
||||
record.m_flAnimTime = pEntity->GetAnimTime();
|
||||
record.m_vecAngles = pEntity->GetAbsAngles();
|
||||
record.m_vecOrigin = pEntity->GetAbsOrigin();
|
||||
record.m_vecAngles = pEntity->GetLocalAngles();
|
||||
record.m_vecOrigin = pEntity->GetLocalOrigin();
|
||||
record.m_vecMinsPreScaled = pEntity->CollisionProp()->OBBMinsPreScaled();
|
||||
record.m_vecMaxsPreScaled = pEntity->CollisionProp()->OBBMaxsPreScaled();
|
||||
|
||||
|
@ -378,8 +378,8 @@ inline void CLagCompensationManager::BacktrackEntity( CBaseEntity* pEntity, int
|
|||
LagRecord* restore = &m_RestoreData[pl_index];
|
||||
LagRecord* change = &m_ChangeData[pl_index];
|
||||
|
||||
QAngle angdiff = pEntity->GetAbsAngles() - ang;
|
||||
Vector orgdiff = pEntity->GetAbsOrigin() - org;
|
||||
QAngle angdiff = pEntity->GetLocalAngles() - ang;
|
||||
Vector orgdiff = pEntity->GetLocalOrigin() - org;
|
||||
|
||||
// Always remember the pristine simulation time in case we need to restore it.
|
||||
restore->m_flSimulationTime = pEntity->GetSimulationTime();
|
||||
|
@ -388,8 +388,8 @@ inline void CLagCompensationManager::BacktrackEntity( CBaseEntity* pEntity, int
|
|||
if ( angdiff.LengthSqr() > 0.0f )
|
||||
{
|
||||
flags |= LC_ANGLES_CHANGED;
|
||||
restore->m_vecAngles = pEntity->GetAbsAngles();
|
||||
pEntity->SetAbsAngles( ang );
|
||||
restore->m_vecAngles = pEntity->GetLocalAngles();
|
||||
pEntity->SetLocalAngles( ang );
|
||||
change->m_vecAngles = ang;
|
||||
}
|
||||
|
||||
|
@ -412,8 +412,8 @@ inline void CLagCompensationManager::BacktrackEntity( CBaseEntity* pEntity, int
|
|||
if ( orgdiff.LengthSqr() > 0.0f )
|
||||
{
|
||||
flags |= LC_ORIGIN_CHANGED;
|
||||
restore->m_vecOrigin = pEntity->GetAbsOrigin();
|
||||
pEntity->SetAbsOrigin( org );
|
||||
restore->m_vecOrigin = pEntity->GetLocalOrigin();
|
||||
pEntity->SetLocalOrigin( org );
|
||||
change->m_vecOrigin = org;
|
||||
}
|
||||
|
||||
|
@ -594,12 +594,12 @@ void CLagCompensationManager::FinishLagCompensation( CBasePlayer* player )
|
|||
|
||||
if ( restore->m_fFlags & LC_ANGLES_CHANGED )
|
||||
{
|
||||
pEntity->SetAbsAngles( restore->m_vecAngles );
|
||||
pEntity->SetLocalAngles( restore->m_vecAngles );
|
||||
}
|
||||
|
||||
if ( restore->m_fFlags & LC_ORIGIN_CHANGED )
|
||||
{
|
||||
pEntity->SetAbsOrigin( restore->m_vecOrigin );
|
||||
pEntity->SetLocalOrigin( restore->m_vecOrigin );
|
||||
}
|
||||
|
||||
auto pAnim = dynamic_cast< CBaseAnimating* >( pEntity );
|
||||
|
|
|
@ -541,8 +541,8 @@ void CCSPlayer::FireBullet(
|
|||
QAngle angles[MAXSTUDIOBONES];
|
||||
int indexes[MAXSTUDIOBONES];
|
||||
|
||||
auto angle = lagPlayer->GetAbsAngles();
|
||||
auto position = lagPlayer->GetAbsOrigin();
|
||||
auto angle = lagPlayer->GetLocalAngles();
|
||||
auto position = lagPlayer->GetLocalOrigin();
|
||||
|
||||
event->SetFloat( "position_x", position.x );
|
||||
event->SetFloat( "position_y", position.y );
|
||||
|
|
|
@ -335,8 +335,8 @@ void FX_FireBullets(
|
|||
|
||||
C_CSPlayer::HitboxRecord record;
|
||||
|
||||
record.m_vecAbsOrigin = lagPlayer->GetAbsOrigin();
|
||||
record.m_angAbsRotation = lagPlayer->GetAbsAngles();
|
||||
record.m_vecLocalOrigin = lagPlayer->GetLocalOrigin();
|
||||
record.m_angLocalAngles = lagPlayer->GetLocalAngles();
|
||||
|
||||
record.m_nAttackerTickBase = pPlayer->m_nTickBase;
|
||||
record.m_flSimulationTime = lagPlayer->m_flInterpolatedSimulationTime;
|
||||
|
|
Loading…
Reference in a new issue