Better to use abs origin and angles for debugging hitboxes
This commit is contained in:
parent
f0954d23f3
commit
690d119fc6
4 changed files with 32 additions and 30 deletions
|
@ -2170,7 +2170,7 @@ void C_CSPlayer::FireGameEvent( IGameEvent* event )
|
||||||
float flBackupBoneControllers[MAXSTUDIOBONECTRLS];
|
float flBackupBoneControllers[MAXSTUDIOBONECTRLS];
|
||||||
|
|
||||||
C_AnimationLayer backupAnimLayers[C_BaseAnimatingOverlay::MAX_OVERLAYS];
|
C_AnimationLayer backupAnimLayers[C_BaseAnimatingOverlay::MAX_OVERLAYS];
|
||||||
Vector vecBackupPosition = player->GetLocalOrigin();
|
Vector vecBackupPosition = player->GetRenderOrigin();
|
||||||
QAngle angBackupAngles = player->GetRenderAngles();
|
QAngle angBackupAngles = player->GetRenderAngles();
|
||||||
auto flOldCycle = player->GetCycle();
|
auto flOldCycle = player->GetCycle();
|
||||||
auto iOldSequence = player->GetSequence();
|
auto iOldSequence = player->GetSequence();
|
||||||
|
@ -2190,9 +2190,9 @@ void C_CSPlayer::FireGameEvent( IGameEvent* event )
|
||||||
backupAnimLayers[i] = *player->GetAnimOverlay( i );
|
backupAnimLayers[i] = *player->GetAnimOverlay( i );
|
||||||
}
|
}
|
||||||
|
|
||||||
player->m_nSequence = event->GetInt( "sequence" );
|
player->SetSequence( event->GetInt( "sequence" ) );
|
||||||
player->m_flCycle = event->GetFloat( "cycle" );
|
player->SetCycle( event->GetFloat( "cycle" ) );
|
||||||
player->SetLocalOrigin( Vector( event->GetFloat( "position_x" ),
|
player->SetAbsOrigin( Vector( event->GetFloat( "position_x" ),
|
||||||
event->GetFloat( "position_y" ),
|
event->GetFloat( "position_y" ),
|
||||||
event->GetFloat( "position_z" ) ) );
|
event->GetFloat( "position_z" ) ) );
|
||||||
|
|
||||||
|
@ -2264,7 +2264,7 @@ void C_CSPlayer::FireGameEvent( IGameEvent* event )
|
||||||
// Let's check what went wrong.
|
// Let's check what went wrong.
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
|
|
||||||
auto newOrigin = player->GetLocalOrigin();
|
auto newOrigin = player->GetRenderOrigin();
|
||||||
auto simtime = event->GetFloat( "simtime" );
|
auto simtime = event->GetFloat( "simtime" );
|
||||||
auto animtime = event->GetFloat( "animtime" );
|
auto animtime = event->GetFloat( "animtime" );
|
||||||
|
|
||||||
|
@ -2273,7 +2273,7 @@ void C_CSPlayer::FireGameEvent( IGameEvent* event )
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
V_sprintf_safe( buffer, "simtime: %f != %f", simtime, pRecord->m_flSimulationTime );
|
V_sprintf_safe( buffer, "simtime: %f != %f", simtime, pRecord->m_flSimulationTime );
|
||||||
|
|
||||||
NDebugOverlay::EntityTextAtPosition( pRecord->m_vecLocalOrigin, pos, buffer, flDuration );
|
NDebugOverlay::EntityTextAtPosition( pRecord->m_vecRenderOrigin, pos, buffer, flDuration );
|
||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2282,41 +2282,41 @@ void C_CSPlayer::FireGameEvent( IGameEvent* event )
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
V_sprintf_safe( buffer, "animtime: %f != %f", animtime, pRecord->m_flAnimTime );
|
V_sprintf_safe( buffer, "animtime: %f != %f", animtime, pRecord->m_flAnimTime );
|
||||||
|
|
||||||
NDebugOverlay::EntityTextAtPosition( pRecord->m_vecLocalOrigin, pos, buffer, flDuration );
|
NDebugOverlay::EntityTextAtPosition( pRecord->m_vecRenderOrigin, pos, buffer, flDuration );
|
||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( pRecord->m_vecLocalOrigin != newOrigin )
|
if ( pRecord->m_vecRenderOrigin != newOrigin )
|
||||||
{
|
{
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
V_sprintf_safe( buffer,
|
V_sprintf_safe( buffer,
|
||||||
"pos: %f != %f, %f != %f, %f != %f",
|
"pos: %f != %f, %f != %f, %f != %f",
|
||||||
newOrigin.x,
|
newOrigin.x,
|
||||||
pRecord->m_vecLocalOrigin.x,
|
pRecord->m_vecRenderOrigin.x,
|
||||||
newOrigin.y,
|
newOrigin.y,
|
||||||
pRecord->m_vecLocalOrigin.y,
|
pRecord->m_vecRenderOrigin.y,
|
||||||
newOrigin.z,
|
newOrigin.z,
|
||||||
pRecord->m_vecLocalOrigin.z );
|
pRecord->m_vecRenderOrigin.z );
|
||||||
|
|
||||||
NDebugOverlay::EntityTextAtPosition( pRecord->m_vecLocalOrigin, pos, buffer, flDuration );
|
NDebugOverlay::EntityTextAtPosition( pRecord->m_vecRenderOrigin, pos, buffer, flDuration );
|
||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto angles = player->GetRenderAngles();
|
auto angles = player->GetRenderAngles();
|
||||||
|
|
||||||
if ( pRecord->m_angLocalAngles != angles )
|
if ( pRecord->m_angRenderAngles != angles )
|
||||||
{
|
{
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
V_sprintf_safe( buffer,
|
V_sprintf_safe( buffer,
|
||||||
"angles: %f != %f, %f != %f, %f != %f",
|
"angles: %f != %f, %f != %f, %f != %f",
|
||||||
angles.x,
|
angles.x,
|
||||||
pRecord->m_angLocalAngles.x,
|
pRecord->m_angRenderAngles.x,
|
||||||
angles.y,
|
angles.y,
|
||||||
pRecord->m_angLocalAngles.y,
|
pRecord->m_angRenderAngles.y,
|
||||||
angles.z,
|
angles.z,
|
||||||
pRecord->m_angLocalAngles.z );
|
pRecord->m_angRenderAngles.z );
|
||||||
|
|
||||||
NDebugOverlay::EntityTextAtPosition( pRecord->m_vecLocalOrigin, pos, buffer, flDuration );
|
NDebugOverlay::EntityTextAtPosition( pRecord->m_vecRenderOrigin, pos, buffer, flDuration );
|
||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2325,7 +2325,7 @@ void C_CSPlayer::FireGameEvent( IGameEvent* event )
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
V_sprintf_safe( buffer, "cycle: %f != %f", player->m_flCycle, pRecord->m_flCycle );
|
V_sprintf_safe( buffer, "cycle: %f != %f", player->m_flCycle, pRecord->m_flCycle );
|
||||||
|
|
||||||
NDebugOverlay::EntityTextAtPosition( pRecord->m_vecLocalOrigin, pos, buffer, flDuration );
|
NDebugOverlay::EntityTextAtPosition( pRecord->m_vecRenderOrigin, pos, buffer, flDuration );
|
||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2339,7 +2339,7 @@ void C_CSPlayer::FireGameEvent( IGameEvent* event )
|
||||||
player->GetSequenceName( pRecord->m_nSequence ),
|
player->GetSequenceName( pRecord->m_nSequence ),
|
||||||
pRecord->m_nSequence );
|
pRecord->m_nSequence );
|
||||||
|
|
||||||
NDebugOverlay::EntityTextAtPosition( pRecord->m_vecLocalOrigin, pos, buffer, flDuration );
|
NDebugOverlay::EntityTextAtPosition( pRecord->m_vecRenderOrigin, pos, buffer, flDuration );
|
||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2355,7 +2355,7 @@ void C_CSPlayer::FireGameEvent( IGameEvent* event )
|
||||||
player->m_flPoseParameter[i],
|
player->m_flPoseParameter[i],
|
||||||
pRecord->m_flPoseParameters[i] );
|
pRecord->m_flPoseParameters[i] );
|
||||||
|
|
||||||
NDebugOverlay::EntityTextAtPosition( pRecord->m_vecLocalOrigin, pos, buffer, flDuration );
|
NDebugOverlay::EntityTextAtPosition( pRecord->m_vecRenderOrigin, pos, buffer, flDuration );
|
||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2372,7 +2372,7 @@ void C_CSPlayer::FireGameEvent( IGameEvent* event )
|
||||||
player->m_flEncodedController[i],
|
player->m_flEncodedController[i],
|
||||||
pRecord->m_flEncodedControllers[i] );
|
pRecord->m_flEncodedControllers[i] );
|
||||||
|
|
||||||
NDebugOverlay::EntityTextAtPosition( pRecord->m_vecLocalOrigin, pos, buffer, flDuration );
|
NDebugOverlay::EntityTextAtPosition( pRecord->m_vecRenderOrigin, pos, buffer, flDuration );
|
||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2405,7 +2405,7 @@ void C_CSPlayer::FireGameEvent( IGameEvent* event )
|
||||||
animOverlay->m_fFlags,
|
animOverlay->m_fFlags,
|
||||||
pRecord->m_AnimationLayer[i].m_fFlags );
|
pRecord->m_AnimationLayer[i].m_fFlags );
|
||||||
|
|
||||||
NDebugOverlay::EntityTextAtPosition( pRecord->m_vecLocalOrigin, pos, buffer, flDuration );
|
NDebugOverlay::EntityTextAtPosition( pRecord->m_vecRenderOrigin, pos, buffer, flDuration );
|
||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2418,17 +2418,19 @@ void C_CSPlayer::FireGameEvent( IGameEvent* event )
|
||||||
nAttackerTickBase );
|
nAttackerTickBase );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
player->PushEnableAbsRecomputations( true );
|
||||||
player->PushAllowBoneAccess( true, false, "Lag compensation context" );
|
player->PushAllowBoneAccess( true, false, "Lag compensation context" );
|
||||||
// Be sure we setup the bones again.
|
// Be sure we setup the bones again.
|
||||||
player->InvalidateBoneCache();
|
player->InvalidateBoneCache();
|
||||||
player->SetupBones( NULL, -1, BONE_USED_BY_ANYTHING, gpGlobals->curtime );
|
player->SetupBones( NULL, -1, BONE_USED_BY_ANYTHING, gpGlobals->curtime );
|
||||||
player->DrawClientHitboxes( flDuration, false );
|
player->DrawClientHitboxes( flDuration, false );
|
||||||
player->PopBoneAccess( "Lag compensation context" );
|
player->PopBoneAccess( "Lag compensation context" );
|
||||||
|
player->PopEnableAbsRecomputations();
|
||||||
|
|
||||||
// Set back original stuff.
|
// Set back original stuff.
|
||||||
player->m_nSequence = iOldSequence;
|
player->SetSequence( iOldSequence );
|
||||||
player->m_flCycle = flOldCycle;
|
player->SetCycle( flOldCycle );
|
||||||
player->SetLocalOrigin( vecBackupPosition );
|
player->SetAbsOrigin( vecBackupPosition );
|
||||||
player->m_angRenderAngles = angBackupAngles;
|
player->m_angRenderAngles = angBackupAngles;
|
||||||
|
|
||||||
for ( int i = 0; i < MAXSTUDIOPOSEPARAM; i++ )
|
for ( int i = 0; i < MAXSTUDIOPOSEPARAM; i++ )
|
||||||
|
|
|
@ -413,8 +413,8 @@ private:
|
||||||
struct HitboxRecord
|
struct HitboxRecord
|
||||||
{
|
{
|
||||||
int m_nAttackerTickBase;
|
int m_nAttackerTickBase;
|
||||||
Vector m_vecLocalOrigin;
|
Vector m_vecRenderOrigin;
|
||||||
QAngle m_angLocalAngles;
|
QAngle m_angRenderAngles;
|
||||||
float m_flSimulationTime;
|
float m_flSimulationTime;
|
||||||
int m_nSequence;
|
int m_nSequence;
|
||||||
float m_flCycle;
|
float m_flCycle;
|
||||||
|
|
|
@ -575,7 +575,7 @@ void CCSPlayer::FireBullet(
|
||||||
int indexes[MAXSTUDIOBONES];
|
int indexes[MAXSTUDIOBONES];
|
||||||
|
|
||||||
auto angle = lagPlayer->GetRenderAngles();
|
auto angle = lagPlayer->GetRenderAngles();
|
||||||
auto position = lagPlayer->GetLocalOrigin();
|
auto position = lagPlayer->GetAbsOrigin();
|
||||||
|
|
||||||
event->SetFloat( "position_x", position.x );
|
event->SetFloat( "position_x", position.x );
|
||||||
event->SetFloat( "position_y", position.y );
|
event->SetFloat( "position_y", position.y );
|
||||||
|
|
|
@ -319,8 +319,8 @@ void FX_FireBullets(
|
||||||
|
|
||||||
C_CSPlayer::HitboxRecord record;
|
C_CSPlayer::HitboxRecord record;
|
||||||
|
|
||||||
record.m_vecLocalOrigin = lagPlayer->GetLocalOrigin();
|
record.m_vecRenderOrigin = lagPlayer->GetRenderOrigin();
|
||||||
record.m_angLocalAngles = lagPlayer->GetRenderAngles();
|
record.m_angRenderAngles = lagPlayer->GetRenderAngles();
|
||||||
|
|
||||||
record.m_nAttackerTickBase = pPlayer->m_nTickBase;
|
record.m_nAttackerTickBase = pPlayer->m_nTickBase;
|
||||||
record.m_flSimulationTime = lagPlayer->m_flInterpolatedSimulationTime;
|
record.m_flSimulationTime = lagPlayer->m_flInterpolatedSimulationTime;
|
||||||
|
|
Loading…
Reference in a new issue