|
|
|
@ -766,6 +766,8 @@ C_CSPlayer::C_CSPlayer() :
|
|
|
|
|
ListenForGameEvent( "bullet_hit_player" );
|
|
|
|
|
ListenForGameEvent( "bullet_player_hitboxes" );
|
|
|
|
|
ListenForGameEvent( "player_lag_hitboxes" );
|
|
|
|
|
|
|
|
|
|
m_bIsInsideLagCompensationContext = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -2136,10 +2138,14 @@ void C_CSPlayer::FireGameEvent( IGameEvent* event )
|
|
|
|
|
const auto nAttackerTickBase = event->GetInt( "tickbase" );
|
|
|
|
|
const auto pStudioHdr = player->GetModelPtr();
|
|
|
|
|
const auto numhitboxes = event->GetInt( "num_hitboxes" );
|
|
|
|
|
const auto parent_index = event->GetInt( "parent_index", -1 );
|
|
|
|
|
|
|
|
|
|
QAngle angles[MAXSTUDIOBONES];
|
|
|
|
|
Vector positions[MAXSTUDIOBONES];
|
|
|
|
|
|
|
|
|
|
player->m_bIsInsideLagCompensationContext = true;
|
|
|
|
|
player->PushEnableAbsRecomputations( true );
|
|
|
|
|
|
|
|
|
|
AssertFatal( numhitboxes == pStudioHdr->pHitboxSet( player->m_nHitboxSet )->numhitboxes );
|
|
|
|
|
|
|
|
|
|
for ( int i = 0; i < numhitboxes; i++ )
|
|
|
|
@ -2170,7 +2176,7 @@ void C_CSPlayer::FireGameEvent( IGameEvent* event )
|
|
|
|
|
float flBackupBoneControllers[MAXSTUDIOBONECTRLS];
|
|
|
|
|
|
|
|
|
|
C_AnimationLayer backupAnimLayers[C_BaseAnimatingOverlay::MAX_OVERLAYS];
|
|
|
|
|
Vector vecBackupPosition = player->GetLocalOrigin();
|
|
|
|
|
Vector vecBackupPosition = player->GetRenderOrigin();
|
|
|
|
|
QAngle angBackupAngles = player->GetRenderAngles();
|
|
|
|
|
auto flOldCycle = player->GetCycle();
|
|
|
|
|
auto iOldSequence = player->GetSequence();
|
|
|
|
@ -2190,11 +2196,11 @@ void C_CSPlayer::FireGameEvent( IGameEvent* event )
|
|
|
|
|
backupAnimLayers[i] = *player->GetAnimOverlay( i );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
player->m_nSequence = event->GetInt( "sequence" );
|
|
|
|
|
player->m_flCycle = event->GetFloat( "cycle" );
|
|
|
|
|
player->SetLocalOrigin( Vector( event->GetFloat( "position_x" ),
|
|
|
|
|
event->GetFloat( "position_y" ),
|
|
|
|
|
event->GetFloat( "position_z" ) ) );
|
|
|
|
|
player->SetSequence( event->GetInt( "sequence" ) );
|
|
|
|
|
player->SetCycle( event->GetFloat( "cycle" ) );
|
|
|
|
|
player->SetAbsOrigin( Vector( event->GetFloat( "position_x" ),
|
|
|
|
|
event->GetFloat( "position_y" ),
|
|
|
|
|
event->GetFloat( "position_z" ) ) );
|
|
|
|
|
|
|
|
|
|
player->m_angRenderAngles = QAngle( event->GetFloat( "angle_x" ),
|
|
|
|
|
event->GetFloat( "angle_y" ),
|
|
|
|
@ -2264,7 +2270,7 @@ void C_CSPlayer::FireGameEvent( IGameEvent* event )
|
|
|
|
|
// Let's check what went wrong.
|
|
|
|
|
int pos = 0;
|
|
|
|
|
|
|
|
|
|
auto newOrigin = player->GetLocalOrigin();
|
|
|
|
|
auto newOrigin = player->GetRenderOrigin();
|
|
|
|
|
auto simtime = event->GetFloat( "simtime" );
|
|
|
|
|
auto animtime = event->GetFloat( "animtime" );
|
|
|
|
|
|
|
|
|
@ -2273,7 +2279,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_vecLocalOrigin, pos, buffer, flDuration );
|
|
|
|
|
NDebugOverlay::EntityTextAtPosition( pRecord->m_vecRenderOrigin, pos, buffer, flDuration );
|
|
|
|
|
pos++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2282,41 +2288,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_vecLocalOrigin, pos, buffer, flDuration );
|
|
|
|
|
NDebugOverlay::EntityTextAtPosition( pRecord->m_vecRenderOrigin, pos, buffer, flDuration );
|
|
|
|
|
pos++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( pRecord->m_vecLocalOrigin != newOrigin )
|
|
|
|
|
if ( pRecord->m_vecRenderOrigin != newOrigin )
|
|
|
|
|
{
|
|
|
|
|
char buffer[256];
|
|
|
|
|
V_sprintf_safe( buffer,
|
|
|
|
|
"pos: %f != %f, %f != %f, %f != %f",
|
|
|
|
|
newOrigin.x,
|
|
|
|
|
pRecord->m_vecLocalOrigin.x,
|
|
|
|
|
pRecord->m_vecRenderOrigin.x,
|
|
|
|
|
newOrigin.y,
|
|
|
|
|
pRecord->m_vecLocalOrigin.y,
|
|
|
|
|
pRecord->m_vecRenderOrigin.y,
|
|
|
|
|
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++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
auto angles = player->GetRenderAngles();
|
|
|
|
|
|
|
|
|
|
if ( pRecord->m_angLocalAngles != angles )
|
|
|
|
|
if ( pRecord->m_angRenderAngles != angles )
|
|
|
|
|
{
|
|
|
|
|
char buffer[256];
|
|
|
|
|
V_sprintf_safe( buffer,
|
|
|
|
|
"angles: %f != %f, %f != %f, %f != %f",
|
|
|
|
|
angles.x,
|
|
|
|
|
pRecord->m_angLocalAngles.x,
|
|
|
|
|
pRecord->m_angRenderAngles.x,
|
|
|
|
|
angles.y,
|
|
|
|
|
pRecord->m_angLocalAngles.y,
|
|
|
|
|
pRecord->m_angRenderAngles.y,
|
|
|
|
|
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++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2325,7 +2331,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_vecLocalOrigin, pos, buffer, flDuration );
|
|
|
|
|
NDebugOverlay::EntityTextAtPosition( pRecord->m_vecRenderOrigin, pos, buffer, flDuration );
|
|
|
|
|
pos++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2339,7 +2345,7 @@ void C_CSPlayer::FireGameEvent( IGameEvent* event )
|
|
|
|
|
player->GetSequenceName( pRecord->m_nSequence ),
|
|
|
|
|
pRecord->m_nSequence );
|
|
|
|
|
|
|
|
|
|
NDebugOverlay::EntityTextAtPosition( pRecord->m_vecLocalOrigin, pos, buffer, flDuration );
|
|
|
|
|
NDebugOverlay::EntityTextAtPosition( pRecord->m_vecRenderOrigin, pos, buffer, flDuration );
|
|
|
|
|
pos++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2355,7 +2361,7 @@ void C_CSPlayer::FireGameEvent( IGameEvent* event )
|
|
|
|
|
player->m_flPoseParameter[i],
|
|
|
|
|
pRecord->m_flPoseParameters[i] );
|
|
|
|
|
|
|
|
|
|
NDebugOverlay::EntityTextAtPosition( pRecord->m_vecLocalOrigin, pos, buffer, flDuration );
|
|
|
|
|
NDebugOverlay::EntityTextAtPosition( pRecord->m_vecRenderOrigin, pos, buffer, flDuration );
|
|
|
|
|
pos++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -2372,7 +2378,7 @@ void C_CSPlayer::FireGameEvent( IGameEvent* event )
|
|
|
|
|
player->m_flEncodedController[i],
|
|
|
|
|
pRecord->m_flEncodedControllers[i] );
|
|
|
|
|
|
|
|
|
|
NDebugOverlay::EntityTextAtPosition( pRecord->m_vecLocalOrigin, pos, buffer, flDuration );
|
|
|
|
|
NDebugOverlay::EntityTextAtPosition( pRecord->m_vecRenderOrigin, pos, buffer, flDuration );
|
|
|
|
|
pos++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -2405,7 +2411,7 @@ void C_CSPlayer::FireGameEvent( IGameEvent* event )
|
|
|
|
|
animOverlay->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++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -2426,9 +2432,9 @@ void C_CSPlayer::FireGameEvent( IGameEvent* event )
|
|
|
|
|
player->PopBoneAccess( "Lag compensation context" );
|
|
|
|
|
|
|
|
|
|
// Set back original stuff.
|
|
|
|
|
player->m_nSequence = iOldSequence;
|
|
|
|
|
player->m_flCycle = flOldCycle;
|
|
|
|
|
player->SetLocalOrigin( vecBackupPosition );
|
|
|
|
|
player->SetSequence( iOldSequence );
|
|
|
|
|
player->SetCycle( flOldCycle );
|
|
|
|
|
player->SetAbsOrigin( vecBackupPosition );
|
|
|
|
|
player->m_angRenderAngles = angBackupAngles;
|
|
|
|
|
|
|
|
|
|
for ( int i = 0; i < MAXSTUDIOPOSEPARAM; i++ )
|
|
|
|
@ -2450,6 +2456,8 @@ void C_CSPlayer::FireGameEvent( IGameEvent* event )
|
|
|
|
|
player->PushAllowBoneAccess( true, false, "Lag compensation context" );
|
|
|
|
|
player->InvalidateBoneCache();
|
|
|
|
|
player->PopBoneAccess( "Lag compensation context" );
|
|
|
|
|
player->PopEnableAbsRecomputations();
|
|
|
|
|
player->m_bIsInsideLagCompensationContext = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
@ -2505,7 +2513,7 @@ Activity C_CSPlayer::GetActivity() const
|
|
|
|
|
|
|
|
|
|
const Vector& C_CSPlayer::GetRenderOrigin( void )
|
|
|
|
|
{
|
|
|
|
|
if ( m_hRagdoll.Get() )
|
|
|
|
|
if ( m_hRagdoll.Get() && !m_bIsInsideLagCompensationContext )
|
|
|
|
|
{
|
|
|
|
|
C_CSRagdoll *pRagdoll = (C_CSRagdoll*)m_hRagdoll.Get();
|
|
|
|
|
if ( pRagdoll->IsInitialized() )
|
|
|
|
@ -2867,6 +2875,8 @@ bool C_CSPlayer::SetupBones( matrix3x4_t* pBoneToWorldOut, int nMaxBones, int bo
|
|
|
|
|
return BaseClass::SetupBones( pBoneToWorldOut, nMaxBones, boneMask, currentTime );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ConVar cl_cs_render_glow_behind_walls("cl_cs_render_glow_behind_walls", "0", FCVAR_CHEAT);
|
|
|
|
|
|
|
|
|
|
#ifdef GLOWS_ENABLE
|
|
|
|
|
void C_CSPlayer::GetGlowEffectColor( float* r, float* g, float* b )
|
|
|
|
|
{
|
|
|
|
@ -2883,8 +2893,21 @@ void C_CSPlayer::GetGlowEffectColor( float* r, float* g, float* b )
|
|
|
|
|
*b = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_bGlowOccluded = false;
|
|
|
|
|
m_bGlowNonOccluded = true;
|
|
|
|
|
if ( cl_cs_render_glow_behind_walls.GetInt() == 1 )
|
|
|
|
|
{
|
|
|
|
|
m_bGlowOccluded = false;
|
|
|
|
|
m_bGlowNonOccluded = true;
|
|
|
|
|
}
|
|
|
|
|
else if ( cl_cs_render_glow_behind_walls.GetInt() == 2 )
|
|
|
|
|
{
|
|
|
|
|
m_bGlowOccluded = true;
|
|
|
|
|
m_bGlowNonOccluded = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
m_bGlowOccluded = false;
|
|
|
|
|
m_bGlowNonOccluded = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|