Now setupbones uses the right angles for cs players

This commit is contained in:
Kamay Xutax 2024-09-02 00:59:19 +02:00
parent be7d8cc228
commit 2782633e53
12 changed files with 98 additions and 25 deletions

View file

@ -1979,7 +1979,8 @@ void C_BaseAnimating::StandardBlendingRules( CStudioHdr *hdr, Vector pos[], Quat
if ( m_pIk ) if ( m_pIk )
{ {
CIKContext auto_ik; CIKContext auto_ik;
auto_ik.Init( hdr, GetRenderAngles(), GetRenderOrigin(), currentTime, gpGlobals->framecount, boneMask ); m_iIKCounter++;
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
@ -2929,7 +2930,8 @@ bool C_BaseAnimating::SetupBones( matrix3x4_t *pBoneToWorldOut, int nMaxBones, i
if (Teleported() || IsNoInterpolationFrame()) if (Teleported() || IsNoInterpolationFrame())
m_pIk->ClearTargets(); m_pIk->ClearTargets();
m_pIk->Init( hdr, GetRenderAngles(), GetRenderOrigin(), currentTime, gpGlobals->framecount, bonesMaskNeedRecalc ); m_iIKCounter++;
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

@ -688,6 +688,7 @@ IMPLEMENT_CLIENTCLASS_DT( C_CSPlayer, DT_CSPlayer, CCSPlayer )
RecvPropInt( RECVINFO( m_iClass ) ), RecvPropInt( RECVINFO( m_iClass ) ),
RecvPropInt( RECVINFO( m_ArmorValue ) ), RecvPropInt( RECVINFO( m_ArmorValue ) ),
RecvPropQAngles( RECVINFO( m_angEyeAngles ) ), RecvPropQAngles( RECVINFO( m_angEyeAngles ) ),
RecvPropQAngles( RECVINFO( m_angRenderAngles ) ),
RecvPropFloat( RECVINFO( m_flStamina ) ), RecvPropFloat( RECVINFO( m_flStamina ) ),
RecvPropInt( RECVINFO( m_bHasDefuser ), 0, RecvProxy_HasDefuser ), RecvPropInt( RECVINFO( m_bHasDefuser ), 0, RecvProxy_HasDefuser ),
RecvPropInt( RECVINFO( m_bNightVisionOn), 0, RecvProxy_NightVision ), RecvPropInt( RECVINFO( m_bNightVisionOn), 0, RecvProxy_NightVision ),
@ -729,11 +730,14 @@ END_RECV_TABLE()
C_CSPlayer::C_CSPlayer() : C_CSPlayer::C_CSPlayer() :
m_iv_angEyeAngles( "C_CSPlayer::m_iv_angEyeAngles" ) m_iv_angEyeAngles( "C_CSPlayer::m_iv_angEyeAngles" ),
m_iv_angRenderAngles( "C_CSPlayer::m_iv_angRenderAngles" )
{ {
m_angEyeAngles.Init(); m_angEyeAngles.Init();
m_angRenderAngles.Init();
// AddVar( &m_angEyeAngles, &m_iv_angEyeAngles, LATCH_SIMULATION_VAR ); AddVar( &m_angEyeAngles, &m_iv_angEyeAngles, LATCH_SIMULATION_VAR );
AddVar( &m_angRenderAngles, &m_iv_angRenderAngles, LATCH_SIMULATION_VAR );
m_iLastAddonBits = m_iAddonBits = 0; m_iLastAddonBits = m_iAddonBits = 0;
m_iLastPrimaryAddon = m_iLastSecondaryAddon = WEAPON_NONE; m_iLastPrimaryAddon = m_iLastSecondaryAddon = WEAPON_NONE;
@ -884,7 +888,7 @@ const QAngle& C_CSPlayer::GetRenderAngles()
} }
else else
{ {
return BaseClass::GetRenderAngles(); return m_angRenderAngles;
} }
} }
@ -2133,7 +2137,7 @@ void C_CSPlayer::FireGameEvent( IGameEvent* event )
if ( index == GetUserID() && IsLocalPlayer() ) if ( index == GetUserID() && IsLocalPlayer() )
{ {
const auto playerIndex = event->GetInt( "player_index" ); const auto playerIndex = event->GetInt( "player_index" );
const auto player = UTIL_PlayerByIndex( playerIndex ); const auto player = ( C_CSPlayer* )UTIL_PlayerByIndex( playerIndex );
if ( player && !player->IsLocalPlayer() ) if ( player && !player->IsLocalPlayer() )
{ {
@ -2169,7 +2173,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->GetAbsOrigin(); Vector vecBackupPosition = player->GetAbsOrigin();
QAngle angBackupAngles = player->GetAbsAngles(); QAngle angBackupAngles = player->m_angRenderAngles;
auto flOldCycle = GetCycle(); auto flOldCycle = GetCycle();
auto iOldSequence = GetSequence(); auto iOldSequence = GetSequence();
@ -2192,9 +2196,10 @@ void C_CSPlayer::FireGameEvent( IGameEvent* event )
player->SetAbsOrigin( 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" ) ) );
player->SetAbsAngles( QAngle( event->GetFloat( "angle_x" ),
event->GetFloat( "angle_y" ), player->m_angRenderAngles = QAngle( event->GetFloat( "angle_x" ),
event->GetFloat( "angle_z" ) ) ); event->GetFloat( "angle_y" ),
event->GetFloat( "angle_z" ) );
const auto numposeparams = event->GetInt( "num_poseparams" ); const auto numposeparams = event->GetInt( "num_poseparams" );
Assert( numposeparams == pStudioHdr->GetNumPoseParameters() ); Assert( numposeparams == pStudioHdr->GetNumPoseParameters() );
@ -2265,7 +2270,7 @@ void C_CSPlayer::FireGameEvent( IGameEvent* event )
player->SetSequence( iOldSequence ); player->SetSequence( iOldSequence );
player->SetCycle( flOldCycle ); player->SetCycle( flOldCycle );
player->SetAbsOrigin( vecBackupPosition ); player->SetAbsOrigin( vecBackupPosition );
player->SetAbsAngles( angBackupAngles ); player->m_angRenderAngles = angBackupAngles;
for ( int i = 0; i < numposeparams; i++ ) for ( int i = 0; i < numposeparams; i++ )
{ {

View file

@ -329,6 +329,7 @@ private:
int m_iClass; int m_iClass;
int m_ArmorValue; int m_ArmorValue;
QAngle m_angEyeAngles; QAngle m_angEyeAngles;
QAngle m_angRenderAngles;
bool m_bHasDefuser; bool m_bHasDefuser;
float m_fNextThinkPushAway; float m_fNextThinkPushAway;
@ -342,6 +343,7 @@ private:
Vector m_vecRagdollVelocity; Vector m_vecRagdollVelocity;
CInterpolatedVar< QAngle > m_iv_angEyeAngles; CInterpolatedVar< QAngle > m_iv_angEyeAngles;
CInterpolatedVar< QAngle > m_iv_angRenderAngles;
// ID Target // ID Target
int m_iIDEntIndex; int m_iIDEntIndex;

View file

@ -434,7 +434,6 @@ void CAnimationLayer::DispatchAnimEvents( CBaseAnimating *eventHandler, CBaseAni
} }
void CBaseAnimatingOverlay::GetSkeleton( CStudioHdr *pStudioHdr, Vector pos[], Quaternion q[], int boneMask ) void CBaseAnimatingOverlay::GetSkeleton( CStudioHdr *pStudioHdr, Vector pos[], Quaternion q[], int boneMask )
{ {
if(!pStudioHdr) if(!pStudioHdr)
@ -481,7 +480,7 @@ void CBaseAnimatingOverlay::GetSkeleton( CStudioHdr *pStudioHdr, Vector pos[], Q
if ( m_pIk ) if ( m_pIk )
{ {
CIKContext auto_ik; CIKContext auto_ik;
auto_ik.Init( pStudioHdr, GetAbsAngles(), GetAbsOrigin(), gpGlobals->curtime, m_iIKCounter, boneMask ); auto_ik.Init( pStudioHdr, GetRenderAngles(), GetRenderOrigin(), gpGlobals->curtime, m_iIKCounter, boneMask );
boneSetup.CalcAutoplaySequences( pos, q, gpGlobals->curtime, &auto_ik ); boneSetup.CalcAutoplaySequences( pos, q, gpGlobals->curtime, &auto_ik );
} }
else else

View file

@ -132,7 +132,7 @@ public:
MAX_OVERLAYS = 15, MAX_OVERLAYS = 15,
}; };
private: protected:
CUtlVector< CAnimationLayer > m_AnimOverlay; CUtlVector< CAnimationLayer > m_AnimOverlay;
//int m_nActiveLayers; //int m_nActiveLayers;
//int m_nActiveBaseLayers; //int m_nActiveBaseLayers;

View file

@ -2029,7 +2029,7 @@ void CBaseAnimating::SetupBones( matrix3x4_t *pBoneToWorld, int boneMask )
// FIXME: pass this into Studio_BuildMatrices to skip transforms // FIXME: pass this into Studio_BuildMatrices to skip transforms
CBoneBitList boneComputed; CBoneBitList boneComputed;
m_iIKCounter++; m_iIKCounter++;
m_pIk->Init( pStudioHdr, GetAbsAngles(), adjOrigin, gpGlobals->curtime, m_iIKCounter, boneMask ); m_pIk->Init( pStudioHdr, GetRenderAngles(), adjOrigin, gpGlobals->curtime, m_iIKCounter, boneMask );
GetSkeleton( pStudioHdr, pos, q, boneMask ); GetSkeleton( pStudioHdr, pos, q, boneMask );
UpdateIKLocks( gpGlobals->curtime ); UpdateIKLocks( gpGlobals->curtime );
@ -2053,7 +2053,7 @@ void CBaseAnimating::SetupBones( matrix3x4_t *pBoneToWorld, int boneMask )
{ {
BuildMatricesWithBoneMerge( BuildMatricesWithBoneMerge(
pStudioHdr, pStudioHdr,
GetAbsAngles(), GetRenderAngles(),
adjOrigin, adjOrigin,
pos, pos,
q, q,
@ -2072,7 +2072,7 @@ void CBaseAnimating::SetupBones( matrix3x4_t *pBoneToWorld, int boneMask )
Studio_BuildMatrices( Studio_BuildMatrices(
pStudioHdr, pStudioHdr,
GetAbsAngles(), GetRenderAngles(),
adjOrigin, adjOrigin,
pos, pos,
q, q,
@ -3033,7 +3033,7 @@ void CBaseAnimating::GetSkeleton( CStudioHdr *pStudioHdr, Vector pos[], Quaterni
if ( m_pIk ) if ( m_pIk )
{ {
CIKContext auto_ik; CIKContext auto_ik;
auto_ik.Init( pStudioHdr, GetAbsAngles(), GetAbsOrigin(), gpGlobals->curtime, m_iIKCounter, boneMask ); auto_ik.Init( pStudioHdr, GetRenderAngles(), GetAbsOrigin(), gpGlobals->curtime, m_iIKCounter, boneMask );
boneSetup.CalcAutoplaySequences( pos, q, gpGlobals->curtime, &auto_ik ); boneSetup.CalcAutoplaySequences( pos, q, gpGlobals->curtime, &auto_ik );
} }
else else

View file

@ -425,7 +425,7 @@ protected:
public: public:
COutputEvent m_OnIgnite; COutputEvent m_OnIgnite;
private: protected:
CStudioHdr *m_pStudioHdr; CStudioHdr *m_pStudioHdr;
CThreadFastMutex m_StudioHdrInitLock; CThreadFastMutex m_StudioHdrInitLock;
CThreadFastMutex m_BoneSetupMutex; CThreadFastMutex m_BoneSetupMutex;

View file

@ -426,6 +426,8 @@ public:
bool IsCurrentlyTouching( void ) const; bool IsCurrentlyTouching( void ) const;
const Vector& GetAbsOrigin( void ) const; const Vector& GetAbsOrigin( void ) const;
const QAngle& GetAbsAngles( void ) const; const QAngle& GetAbsAngles( void ) const;
virtual const Vector& GetRenderOrigin( void ) const { return GetAbsOrigin(); }
virtual const QAngle& GetRenderAngles( void ) const { return GetAbsAngles(); }
SolidType_t GetSolid() const; SolidType_t GetSolid() const;
int GetSolidFlags( void ) const; int GetSolidFlags( void ) const;

View file

@ -6,6 +6,7 @@
//=============================================================================// //=============================================================================//
#include "cbase.h" #include "cbase.h"
#include "bone_setup.h"
#include "cs_player.h" #include "cs_player.h"
#include "cs_gamerules.h" #include "cs_gamerules.h"
#include "dt_send.h" #include "dt_send.h"
@ -300,6 +301,7 @@ IMPLEMENT_SERVERCLASS_ST( CCSPlayer, DT_CSPlayer )
SendPropInt( SENDINFO( m_iClass ), Q_log2( CS_NUM_CLASSES )+1, SPROP_UNSIGNED ), SendPropInt( SENDINFO( m_iClass ), Q_log2( CS_NUM_CLASSES )+1, SPROP_UNSIGNED ),
SendPropInt( SENDINFO( m_ArmorValue ), 8 ), SendPropInt( SENDINFO( m_ArmorValue ), 8 ),
SendPropQAngles(SENDINFO(m_angEyeAngles)), SendPropQAngles(SENDINFO(m_angEyeAngles)),
SendPropQAngles(SENDINFO(m_angRenderAngles)),
SendPropBool( SENDINFO( m_bHasDefuser ) ), SendPropBool( SENDINFO( m_bHasDefuser ) ),
SendPropBool( SENDINFO( m_bNightVisionOn ) ), //send as int so we can use a RecvProxy on the client SendPropBool( SENDINFO( m_bNightVisionOn ) ), //send as int so we can use a RecvProxy on the client
SendPropBool( SENDINFO( m_bHasNightVision ) ), SendPropBool( SENDINFO( m_bHasNightVision ) ),
@ -1161,7 +1163,7 @@ void CCSPlayer::Event_Killed( const CTakeDamageInfo &info )
{ {
if ( RandomInt( 0, 100 ) < 20 ) if ( RandomInt( 0, 100 ) < 20 )
{ {
CHolidayGift::Create( WorldSpaceCenter(), GetAbsAngles(), EyeAngles(), GetAbsVelocity(), this ); CHolidayGift::Create( WorldSpaceCenter(), GetRenderAngles(), EyeAngles(), GetAbsVelocity(), this );
} }
} }
@ -1452,7 +1454,7 @@ void CCSPlayer::UpdateRadar()
WRITE_SBITLONG( pPlayer->GetAbsOrigin().x/4, COORD_INTEGER_BITS-1 ); WRITE_SBITLONG( pPlayer->GetAbsOrigin().x/4, COORD_INTEGER_BITS-1 );
WRITE_SBITLONG( pPlayer->GetAbsOrigin().y/4, COORD_INTEGER_BITS-1 ); WRITE_SBITLONG( pPlayer->GetAbsOrigin().y/4, COORD_INTEGER_BITS-1 );
WRITE_SBITLONG( pPlayer->GetAbsOrigin().z/4, COORD_INTEGER_BITS-1 ); WRITE_SBITLONG( pPlayer->GetAbsOrigin().z/4, COORD_INTEGER_BITS-1 );
WRITE_SBITLONG( AngleNormalize( pPlayer->GetAbsAngles().y ), 9 ); WRITE_SBITLONG( AngleNormalize( pPlayer->GetRenderAngles().y ), 9 );
} }
WRITE_BYTE( 0 ); // end marker WRITE_BYTE( 0 ); // end marker
@ -1574,6 +1576,8 @@ void CCSPlayer::PostThink()
m_PlayerAnimState->Update( m_angEyeAngles[YAW], m_angEyeAngles[PITCH] ); m_PlayerAnimState->Update( m_angEyeAngles[YAW], m_angEyeAngles[PITCH] );
m_angRenderAngles = m_PlayerAnimState->GetRenderAngles();
// check if we need to apply a deafness DSP effect. // check if we need to apply a deafness DSP effect.
if ((m_applyDeafnessTime != 0.0f) && (m_applyDeafnessTime <= gpGlobals->curtime)) if ((m_applyDeafnessTime != 0.0f) && (m_applyDeafnessTime <= gpGlobals->curtime))
{ {
@ -2768,7 +2772,7 @@ void CCSPlayer::DropShield( void )
#ifdef CS_SHIELD_ENABLED #ifdef CS_SHIELD_ENABLED
//Drop an item_defuser //Drop an item_defuser
Vector vForward, vRight; Vector vForward, vRight;
AngleVectors( GetAbsAngles(), &vForward, &vRight, NULL ); AngleVectors( GetRenderAngles(), &vForward, &vRight, NULL );
RemoveShield(); RemoveShield();
@ -6707,7 +6711,7 @@ void CCSPlayer::DropWeapons( bool fromDeath, bool friendlyFire )
{ {
//Drop an item_defuser //Drop an item_defuser
Vector vForward, vRight; Vector vForward, vRight;
AngleVectors( GetAbsAngles(), &vForward, &vRight, NULL ); AngleVectors( GetRenderAngles(), &vForward, &vRight, NULL );
CBaseAnimating *pDefuser = (CBaseAnimating *)CBaseEntity::Create( "item_defuser", WorldSpaceCenter(), GetLocalAngles(), this ); CBaseAnimating *pDefuser = (CBaseAnimating *)CBaseEntity::Create( "item_defuser", WorldSpaceCenter(), GetLocalAngles(), this );
pDefuser->ApplyAbsVelocityImpulse( vForward * 200 + vRight * random->RandomFloat( -50, 50 ) ); pDefuser->ApplyAbsVelocityImpulse( vForward * 200 + vRight * random->RandomFloat( -50, 50 ) );

View file

@ -287,6 +287,9 @@ public:
virtual void SetupVisibility( CBaseEntity *pViewEntity, unsigned char *pvs, int pvssize ); virtual void SetupVisibility( CBaseEntity *pViewEntity, unsigned char *pvs, int pvssize );
virtual int GetNextObserverSearchStartPoint( bool bReverse ); virtual int GetNextObserverSearchStartPoint( bool bReverse );
virtual const QAngle& GetRenderAngles( void ) const { return m_angRenderAngles; }
// In shared code. // In shared code.
public: public:
@ -813,6 +816,7 @@ public:
// Copyed from EyeAngles() so we can send it to the client. // Copyed from EyeAngles() so we can send it to the client.
CNetworkQAngle( m_angEyeAngles ); CNetworkQAngle( m_angEyeAngles );
CNetworkQAngle( m_angRenderAngles );
bool m_bVCollisionInitted; bool m_bVCollisionInitted;

View file

@ -6,6 +6,9 @@
//=============================================================================// //=============================================================================//
#include "cbase.h" #include "cbase.h"
#ifdef CSTRIKE_DLL
#include "cs_player.h"
#endif
#include "icvar.h" #include "icvar.h"
#include "player.h" #include "player.h"
#include "shareddefs.h" #include "shareddefs.h"
@ -88,6 +91,9 @@ struct LagRecord
{ {
m_encodedControllers[i] = 0; m_encodedControllers[i] = 0;
} }
#ifdef CSTRIKE_DLL
m_angRenderAngles.Init();
#endif
} }
LagRecord( const LagRecord& src ) LagRecord( const LagRecord& src )
@ -117,6 +123,10 @@ struct LagRecord
{ {
m_encodedControllers[i] = src.m_encodedControllers[i]; m_encodedControllers[i] = src.m_encodedControllers[i];
} }
#ifdef CSTRIKE_DLL
m_angRenderAngles = src.m_angRenderAngles;
#endif
} }
// Did player die this frame // Did player die this frame
@ -137,6 +147,9 @@ struct LagRecord
float m_masterCycle; float m_masterCycle;
float m_poseParameters[MAXSTUDIOPOSEPARAM]; float m_poseParameters[MAXSTUDIOPOSEPARAM];
float m_encodedControllers[MAXSTUDIOBONECTRLS]; float m_encodedControllers[MAXSTUDIOBONECTRLS];
#ifdef CSTRIKE_DLL
QAngle m_angRenderAngles;
#endif
}; };
// //
@ -323,6 +336,15 @@ void CLagCompensationManager::TrackPlayerData( CBasePlayer* pPlayer )
} }
} }
#ifdef CSTRIKE_DLL
const auto csPlayer = dynamic_cast< CCSPlayer* >( pPlayer );
if ( csPlayer )
{
record.m_angRenderAngles = csPlayer->m_angRenderAngles;
}
#endif
track->Push( record ); track->Push( record );
} }
@ -384,10 +406,17 @@ void CLagCompensationManager::BacktrackPlayer( CBasePlayer* pPlayer, CUserCmd* c
Vector minsPreScaled; Vector minsPreScaled;
Vector maxsPreScaled; Vector maxsPreScaled;
QAngle ang; QAngle ang;
#ifdef CSTRIKE_DLL
QAngle renderAngles;
#endif
LagRecord* nextRecordSim; LagRecord* nextRecordSim;
LagRecord* recordSim; LagRecord* recordSim;
LagRecord* recordAnim; LagRecord* recordAnim;
#ifdef CSTRIKE_DLL
auto csPlayer = dynamic_cast< CCSPlayer* >( pPlayer );
#endif
int pl_index = pPlayer->entindex(); int pl_index = pPlayer->entindex();
float flTargetLerpSimTime = cmd->simulationdata[pl_index].lerp_time; float flTargetLerpSimTime = cmd->simulationdata[pl_index].lerp_time;
@ -470,6 +499,12 @@ void CLagCompensationManager::BacktrackPlayer( CBasePlayer* pPlayer, CUserCmd* c
org = Lerp( fracSim, recordSim->m_vecOrigin, nextRecordSim->m_vecOrigin ); org = Lerp( fracSim, recordSim->m_vecOrigin, nextRecordSim->m_vecOrigin );
minsPreScaled = Lerp( fracSim, recordSim->m_vecMinsPreScaled, nextRecordSim->m_vecMinsPreScaled ); minsPreScaled = Lerp( fracSim, recordSim->m_vecMinsPreScaled, nextRecordSim->m_vecMinsPreScaled );
maxsPreScaled = Lerp( fracSim, recordSim->m_vecMaxsPreScaled, nextRecordSim->m_vecMaxsPreScaled ); maxsPreScaled = Lerp( fracSim, recordSim->m_vecMaxsPreScaled, nextRecordSim->m_vecMaxsPreScaled );
#ifdef CSTRIKE_DLL
if ( csPlayer )
{
renderAngles = Lerp( fracSim, recordSim->m_angRenderAngles, nextRecordSim->m_angRenderAngles );
}
#endif
} }
else else
{ {
@ -479,6 +514,9 @@ void CLagCompensationManager::BacktrackPlayer( CBasePlayer* pPlayer, CUserCmd* c
ang = recordSim->m_vecAngles; ang = recordSim->m_vecAngles;
minsPreScaled = recordSim->m_vecMinsPreScaled; minsPreScaled = recordSim->m_vecMinsPreScaled;
maxsPreScaled = recordSim->m_vecMaxsPreScaled; maxsPreScaled = recordSim->m_vecMaxsPreScaled;
#ifdef CSTRIKE_DLL
renderAngles = recordSim->m_angRenderAngles;
#endif
} }
// See if this represents a change for the player // See if this represents a change for the player
@ -493,6 +531,14 @@ void CLagCompensationManager::BacktrackPlayer( CBasePlayer* pPlayer, CUserCmd* c
restore->m_flSimulationTime = pPlayer->GetSimulationTime(); restore->m_flSimulationTime = pPlayer->GetSimulationTime();
restore->m_flAnimTime = pPlayer->GetAnimTime(); restore->m_flAnimTime = pPlayer->GetAnimTime();
#ifdef CSTRIKE_DLL
if ( csPlayer )
{
restore->m_angRenderAngles = csPlayer->m_angRenderAngles;
csPlayer->m_angRenderAngles = renderAngles;
}
#endif
if ( angdiff.LengthSqr() > 0.0f ) if ( angdiff.LengthSqr() > 0.0f )
{ {
flags |= LC_ANGLES_CHANGED; flags |= LC_ANGLES_CHANGED;
@ -634,6 +680,15 @@ void CLagCompensationManager::FinishLagCompensation( CBasePlayer* player )
LagRecord* restore = &m_RestoreData[i]; LagRecord* restore = &m_RestoreData[i];
LagRecord* change = &m_ChangeData[i]; LagRecord* change = &m_ChangeData[i];
#ifdef CSTRIKE_DLL
auto csPlayer = dynamic_cast< CCSPlayer* >( pPlayer );
if ( csPlayer )
{
csPlayer->m_angRenderAngles = restore->m_angRenderAngles;
}
#endif
if ( restore->m_fFlags & LC_SIZE_CHANGED ) if ( restore->m_fFlags & LC_SIZE_CHANGED )
{ {
// see if simulation made any changes, if no, then do the restore, otherwise, // see if simulation made any changes, if no, then do the restore, otherwise,

View file

@ -541,8 +541,8 @@ void CCSPlayer::FireBullet(
QAngle angles[MAXSTUDIOBONES]; QAngle angles[MAXSTUDIOBONES];
int indexes[MAXSTUDIOBONES]; int indexes[MAXSTUDIOBONES];
auto angle = lagPlayer->GetAbsAngles(); auto angle = lagPlayer->GetRenderAngles();
auto position = lagPlayer->GetAbsOrigin(); auto position = lagPlayer->GetRenderOrigin();
event->SetFloat( "position_x", position.x ); event->SetFloat( "position_x", position.x );
event->SetFloat( "position_y", position.y ); event->SetFloat( "position_y", position.y );