Compare commits

..

5 commits

24 changed files with 149 additions and 105 deletions

View file

@ -24,9 +24,6 @@ END_RECV_TABLE()
//-----------------------------------------------------------------------------
C_NextBotCombatCharacter::C_NextBotCombatCharacter()
{
// Left4Dead have surfaces too steep for IK to work properly
m_EntClientFlags |= ENTCLIENTFLAG_DONTUSEIK;
m_shadowType = SHADOWS_SIMPLE;
m_forcedShadowType = SHADOWS_NONE;
m_bForceShadowType = false;

View file

@ -181,7 +181,8 @@ IMPLEMENT_CLIENTCLASS_DT(C_BaseAnimating, DT_BaseAnimating, CBaseAnimating)
RecvPropFloat( RECVINFO( m_fadeMinDist ) ),
RecvPropFloat( RECVINFO( m_fadeMaxDist ) ),
RecvPropFloat( RECVINFO( m_flFadeScale ) )
RecvPropFloat( RECVINFO( m_flFadeScale ) ),
RecvPropBool( RECVINFO(m_bUseIks) )
END_RECV_TABLE()
@ -1151,24 +1152,26 @@ CStudioHdr *C_BaseAnimating::OnNewModel()
AddEFlags( EFL_USE_PARTITION_WHEN_NOT_SOLID );
}
// Most entities clear out their sequences when they change models on the server, but
// not all entities network down their m_nSequence (like multiplayer game player entities),
// so we may need to clear it out here. Force a SetSequence call no matter what, though.
int forceSequence = ShouldResetSequenceOnNewModel() ? 0 : m_nSequence;
if ( GetSequence() >= hdr->GetNumSeq() )
if (m_bClientSideAnimation)
{
forceSequence = 0;
}
// Most entities clear out their sequences when they change models on the server, but
// not all entities network down their m_nSequence (like multiplayer game player entities),
// so we may need to clear it out here. Force a SetSequence call no matter what, though.
int forceSequence = ShouldResetSequenceOnNewModel() ? 0 : m_nSequence;
m_nSequence = -1;
SetSequence( forceSequence );
if ( GetSequence() >= hdr->GetNumSeq() )
{
forceSequence = 0;
}
if ( m_bResetSequenceInfoOnLoad )
{
m_bResetSequenceInfoOnLoad = false;
ResetSequenceInfo();
m_nSequence = -1;
SetSequence( forceSequence );
if ( m_bResetSequenceInfoOnLoad )
{
m_bResetSequenceInfoOnLoad = false;
ResetSequenceInfo();
}
}
return hdr;
@ -2877,12 +2880,12 @@ bool C_BaseAnimating::SetupBones( matrix3x4_t *pBoneToWorldOut, int nMaxBones, i
AddFlag( EFL_SETTING_UP_BONES );
// NOTE: For model scaling, we need to opt out of IK because it will mark the bones as already being calculated
if ( !IsModelScaled() )
if ( !IsModelScaled() && m_bUseIks )
{
// only allocate an ik block if the npc can use it
// The flag is now completely ignored to match server bones!
// If it doesn't work well, blame models.
if ( !m_pIk && hdr->numikchains() > 0 && !(m_EntClientFlags & ENTCLIENTFLAG_DONTUSEIK) )
if ( !m_pIk && hdr->numikchains() > 0 )
{
m_pIk = new CIKContext;
}
@ -4218,16 +4221,17 @@ bool C_BaseAnimating::IsSelfAnimating()
if ( m_bClientSideAnimation )
return true;
// Yes, we use animtime.
int iMoveType = GetMoveType();
if ( iMoveType != MOVETYPE_STEP &&
iMoveType != MOVETYPE_NONE &&
iMoveType != MOVETYPE_WALK &&
iMoveType != MOVETYPE_FLY &&
iMoveType != MOVETYPE_FLYGRAVITY )
{
return true;
}
// TODO_ENHANCED: check if that's correct to do, since we use server side animations.
// // Yes, we use animtime.
// int iMoveType = GetMoveType();
// if ( iMoveType != MOVETYPE_STEP &&
// iMoveType != MOVETYPE_NONE &&
// iMoveType != MOVETYPE_WALK &&
// iMoveType != MOVETYPE_FLY &&
// iMoveType != MOVETYPE_FLYGRAVITY )
// {
// return true;
// }
return false;
}
@ -5100,7 +5104,7 @@ float C_BaseAnimating::GetLastVisibleCycle( CStudioHdr *pStudioHdr, int iSequenc
//=========================================================
void C_BaseAnimating::StudioFrameAdvance()
{
if ( m_bClientSideAnimation )
if ( !m_bClientSideAnimation )
return;
CStudioHdr *hdr = GetModelPtr();

View file

@ -6,6 +6,8 @@
//===========================================================================//
#include "cbase.h"
#include "c_baseentity.h"
#include "convar.h"
#include "iconvar.h"
#include "interpolatedvar.h"
#include "prediction.h"
#include "model_types.h"
@ -6340,6 +6342,11 @@ bool C_BaseEntity::ValidateEntityAttachedToPlayer( bool &bShouldRetry )
}
#endif // TF_CLIENT_DLL
ConVar cl_interp_no_hermite( "cl_interp_no_hermite",
"1",
FCVAR_NOT_CONNECTED,
"This fixes lag compensation and game screen not respecting camera's at the expense of "
"maybe more unsmooth game play. (maybe)" );
void C_BaseEntity::AddVar( void *data, IInterpolatedVar *watcher, int type, bool bSetup )
{
@ -6350,7 +6357,16 @@ void C_BaseEntity::AddVar( void *data, IInterpolatedVar *watcher, int type, bool
// This is needed to get the perfect lag compensation for origin.
// It's possible to have hermite interpolation in lag compensation,
// but it would require some extra flags being sent to the server.
type |= INTERPOLATE_LINEAR_ONLY;
if ( cl_interp_no_hermite.GetBool() )
{
type |= INTERPOLATE_LINEAR_ONLY;
DevMsg( "Linear only interpolation enabled for entity %i (varname: %s) !\n", index, watcher->GetDebugName());
}
else
{
DevMsg( "Hermite interpolation enabled for entity: %i (varname: %s) !\n", index, watcher->GetDebugName());
}
for ( int i=0; i < m_VarMap.m_Entries.Count(); i++ )
{

View file

@ -178,7 +178,6 @@ struct thinkfunc_t
// Entity flags that only exist on the client.
#define ENTCLIENTFLAG_GETTINGSHADOWRENDERBOUNDS 0x0001 // Tells us if we're getting the real ent render bounds or the shadow render bounds.
#define ENTCLIENTFLAG_DONTUSEIK 0x0002 // Don't use IK on this entity even if its model has IK.
#define ENTCLIENTFLAG_ALWAYS_INTERPOLATE 0x0004 // Used by view models.
//-----------------------------------------------------------------------------
@ -1286,6 +1285,7 @@ public:
// Entity flags that are only for the client (ENTCLIENTFLAG_ defines).
unsigned short m_EntClientFlags;
bool m_bUseIks;
CNetworkColor32( m_clrRender );

View file

@ -110,7 +110,6 @@ bool C_LowViolenceHostageDeathModel::SetupLowViolenceModel( C_CHostage *pHostage
SetNextClientThink( CLIENT_THINK_ALWAYS );
SetSequence( LookupSequence( "death1" ) );
ForceClientSideAnimationOn();
if ( pHostage && !pHostage->IsDormant() )
{
@ -202,16 +201,6 @@ C_CHostage::C_CHostage()
m_flDeadOrRescuedTime = 0.0;
m_flLastBodyYaw = 0;
m_createdLowViolenceRagdoll = false;
// TODO: Get IK working on the steep slopes CS has, then enable it on characters.
// Breaks server side setup bones !
// m_EntClientFlags |= ENTCLIENTFLAG_DONTUSEIK;
// set the model so the PlayerAnimState uses the Hostage activities/sequences
SetModelName( "models/Characters/Hostage_01.mdl" );
m_PlayerAnimState = CreateHostageAnimState( this, this, LEGANIM_8WAY, false );
m_leader = NULL;
m_blinkTimer.Invalidate();
m_seq = -1;
@ -234,7 +223,6 @@ C_CHostage::C_CHostage()
C_CHostage::~C_CHostage()
{
g_Hostages.FindAndRemove( this );
m_PlayerAnimState->Release();
}
//-----------------------------------------------------------------------------
@ -439,8 +427,6 @@ void C_CHostage::UpdateClientSideAnimation()
return;
}
m_PlayerAnimState->Update( GetAbsAngles()[YAW], GetAbsAngles()[PITCH] );
// initialize pose parameters
char *setToZero[] =
{

View file

@ -65,8 +65,6 @@ private:
int m_OldLifestate;
int m_iMaxHealth;
ICSPlayerAnimState *m_PlayerAnimState;
CNetworkVar( EHANDLE, m_leader ); // who we are following, or NULL
CNetworkVar( bool, m_isRescued );

View file

@ -385,7 +385,6 @@ void C_CSRagdoll::CreateLowViolenceRagdoll( void )
char str[512];
Q_snprintf( str, sizeof( str ), "death%d", iDeathAnim );
SetSequence( LookupSequence( str ) );
ForceClientSideAnimationOn();
Interp_Reset( GetVarMapping() );
}
@ -691,6 +690,7 @@ IMPLEMENT_CLIENTCLASS_DT( C_CSPlayer, DT_CSPlayer, CCSPlayer )
RecvPropInt( RECVINFO( m_iClass ) ),
RecvPropInt( RECVINFO( m_ArmorValue ) ),
RecvPropQAngles( RECVINFO( m_angEyeAngles ) ),
RecvPropQAngles( RECVINFO( m_angRenderAngles ) ),
RecvPropFloat( RECVINFO( m_flStamina ) ),
RecvPropInt( RECVINFO( m_bHasDefuser ), 0, RecvProxy_HasDefuser ),
RecvPropInt( RECVINFO( m_bNightVisionOn), 0, RecvProxy_NightVision ),
@ -739,6 +739,8 @@ C_CSPlayer::C_CSPlayer() :
AddVar( &m_angEyeAngles, &m_iv_angEyeAngles, LATCH_SIMULATION_VAR );
// interpolation on m_angRenderAngles later
m_iLastAddonBits = m_iAddonBits = 0;
m_iLastPrimaryAddon = m_iLastSecondaryAddon = WEAPON_NONE;
m_iProgressBarDuration = 0;
@ -880,19 +882,6 @@ int C_CSPlayer::GetCurrentAssaultSuitPrice()
}
}
const QAngle& C_CSPlayer::GetRenderAngles()
{
if ( IsRagdoll() )
{
return vec3_angle;
}
else
{
return BaseClass::GetRenderAngles();
}
}
float g_flFattenAmt = 4;
void C_CSPlayer::GetShadowRenderBounds( Vector &mins, Vector &maxs, ShadowType_t shadowType )
{
@ -2182,7 +2171,7 @@ void C_CSPlayer::FireGameEvent( IGameEvent* event )
C_AnimationLayer backupAnimLayers[C_BaseAnimatingOverlay::MAX_OVERLAYS];
Vector vecBackupPosition = player->GetLocalOrigin();
QAngle angBackupAngles = player->GetLocalAngles();
QAngle angBackupAngles = player->GetRenderAngles();
auto flOldCycle = player->GetCycle();
auto iOldSequence = player->GetSequence();
@ -2207,9 +2196,9 @@ void C_CSPlayer::FireGameEvent( IGameEvent* event )
event->GetFloat( "position_y" ),
event->GetFloat( "position_z" ) ) );
player->SetLocalAngles( QAngle( event->GetFloat( "angle_x" ),
event->GetFloat( "angle_y" ),
event->GetFloat( "angle_z" ) ) );
player->m_angRenderAngles = QAngle( event->GetFloat( "angle_x" ),
event->GetFloat( "angle_y" ),
event->GetFloat( "angle_z" ) );
const auto numposeparams = event->GetInt( "num_poseparams" );
AssertFatal( numposeparams == pStudioHdr->GetNumPoseParameters() );
@ -2313,7 +2302,7 @@ void C_CSPlayer::FireGameEvent( IGameEvent* event )
pos++;
}
auto angles = player->GetLocalAngles();
auto angles = player->GetRenderAngles();
if ( pRecord->m_angLocalAngles != angles )
{
@ -2440,7 +2429,7 @@ void C_CSPlayer::FireGameEvent( IGameEvent* event )
player->m_nSequence = iOldSequence;
player->m_flCycle = flOldCycle;
player->SetLocalOrigin( vecBackupPosition );
player->SetLocalAngles( angBackupAngles );
player->m_angRenderAngles = angBackupAngles;
for ( int i = 0; i < MAXSTUDIOPOSEPARAM; i++ )
{

View file

@ -6,6 +6,7 @@
#ifndef C_CS_PLAYER_H
#define C_CS_PLAYER_H
#include "mathlib/vector.h"
#ifdef _WIN32
#pragma once
#endif
@ -424,6 +425,8 @@ private:
};
CUtlCircularBuffer< HitboxRecord, MAX_HISTORY_HITBOX_RECORDS > m_HitboxTrack[MAX_PLAYERS + 1];
QAngle m_angRenderAngles;
};
C_CSPlayer* GetLocalOrInEyeCSPlayer( void );

View file

@ -419,7 +419,6 @@ void C_DODRagdoll::CreateLowViolenceRagdoll()
Q_snprintf( str, sizeof( str ), "death%d", iDeathAnim );
SetSequence( LookupSequence( str ) );
ForceClientSideAnimationOn();
SetNetworkOrigin( m_vecRagdollOrigin );
SetAbsOrigin( m_vecRagdollOrigin );

View file

@ -54,7 +54,7 @@ C_HL2MP_Player::C_HL2MP_Player() : m_PlayerAnimState( this ), m_iv_angEyeAngles(
AddVar( &m_angEyeAngles, &m_iv_angEyeAngles, LATCH_SIMULATION_VAR );
m_EntClientFlags |= ENTCLIENTFLAG_DONTUSEIK;
DisableServerIK();
m_blinkTimer.Invalidate();
m_pFlashlightBeam = NULL;

View file

@ -13,7 +13,6 @@
#include "tier1/utllinkedlist.h"
#include "rangecheckedvar.h"
#include "lerp_functions.h"
#include "animationlayer.h"
#include "convar.h"

View file

@ -324,7 +324,7 @@ C_Portal_Player::C_Portal_Player()
AddVar( &m_angEyeAngles, &m_iv_angEyeAngles, LATCH_SIMULATION_VAR );
m_EntClientFlags |= ENTCLIENTFLAG_DONTUSEIK;
DisableServerIK();
m_blinkTimer.Invalidate();
m_CCDeathHandle = INVALID_CLIENT_CCHANDLE;

View file

@ -480,7 +480,7 @@ void CBaseAnimatingOverlay::GetSkeleton( CStudioHdr *pStudioHdr, Vector pos[], Q
if ( m_pIk )
{
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 );
}
else

View file

@ -215,6 +215,9 @@ NextBotCombatCharacter::NextBotCombatCharacter( void )
{
m_lastAttacker = NULL;
m_didModelChange = false;
// Left4Dead have surfaces too steep for IK to work properly
DisableServerIK();
}

View file

@ -4,6 +4,7 @@
//
//=============================================================================//
#include "ai_activity.h"
#include "cbase.h"
#include "baseanimating.h"
#include "animation.h"
@ -261,7 +262,8 @@ IMPLEMENT_SERVERCLASS_ST(CBaseAnimating, DT_BaseAnimating)
// Fading
SendPropFloat( SENDINFO( m_fadeMinDist ), 0, SPROP_NOSCALE ),
SendPropFloat( SENDINFO( m_fadeMaxDist ), 0, SPROP_NOSCALE ),
SendPropFloat( SENDINFO( m_flFadeScale ), 0, SPROP_NOSCALE )
SendPropFloat( SENDINFO( m_flFadeScale ), 0, SPROP_NOSCALE ),
SendPropBool( SENDINFO( m_bUseIks ) )
END_SEND_TABLE()
@ -289,6 +291,7 @@ CBaseAnimating::CBaseAnimating()
m_fadeMaxDist = 0;
m_flFadeScale = 0.0f;
m_fBoneCacheFlags = 0;
m_bUseIks = true;
}
CBaseAnimating::~CBaseAnimating()
@ -387,7 +390,7 @@ void CBaseAnimating::Spawn()
//-----------------------------------------------------------------------------
void CBaseAnimating::UseClientSideAnimation()
{
m_bClientSideAnimation = false;
m_bClientSideAnimation = true;
}
#define MAX_ANIMTIME_INTERVAL 0.2f
@ -1670,7 +1673,7 @@ void CBaseAnimating::CalculateIKLocks( float currentTime )
// FIXME: trace based on gravity or trace based on angles?
Vector up;
AngleVectors( GetAbsAngles(), NULL, NULL, &up );
AngleVectors( GetRenderAngles(), NULL, NULL, &up );
// FIXME: check number of slots?
float minHeight = FLT_MAX;
@ -1781,7 +1784,7 @@ void CBaseAnimating::CalculateIKLocks( float currentTime )
else if (trace.DidHitNonWorldEntity())
{
pTarget->SetPos( trace.endpos );
pTarget->SetAngles( GetAbsAngles() );
pTarget->SetAngles( GetRenderAngles() );
// only do this on forward tracking or commited IK ground rules
if (pTarget->est.release < 0.1)
@ -1815,7 +1818,7 @@ void CBaseAnimating::CalculateIKLocks( float currentTime )
else
{
pTarget->SetPos( trace.endpos );
pTarget->SetAngles( GetAbsAngles() );
pTarget->SetAngles( GetRenderAngles() );
pTarget->SetOnWorld( true );
}
}
@ -2031,7 +2034,7 @@ void CBaseAnimating::SetupBones( matrix3x4_t *pBoneToWorld, int boneMask )
// FIXME: pass this into Studio_BuildMatrices to skip transforms
CBoneBitList boneComputed;
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 );
UpdateIKLocks( gpGlobals->curtime );
@ -2055,7 +2058,7 @@ void CBaseAnimating::SetupBones( matrix3x4_t *pBoneToWorld, int boneMask )
{
BuildMatricesWithBoneMerge(
pStudioHdr,
GetAbsAngles(),
GetRenderAngles(),
adjOrigin,
pos,
q,
@ -2074,7 +2077,7 @@ void CBaseAnimating::SetupBones( matrix3x4_t *pBoneToWorld, int boneMask )
Studio_BuildMatrices(
pStudioHdr,
GetAbsAngles(),
GetRenderAngles(),
adjOrigin,
pos,
q,
@ -3036,7 +3039,7 @@ void CBaseAnimating::GetSkeleton( CStudioHdr *pStudioHdr, Vector pos[], Quaterni
if ( m_pIk )
{
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 );
}
else
@ -3499,17 +3502,12 @@ int CBaseAnimating::GetHitboxesFrontside( int *boxList, int boxMax, const Vector
void CBaseAnimating::EnableServerIK()
{
if (!m_pIk)
{
m_pIk = new CIKContext;
m_iIKCounter = 0;
}
m_bUseIks = true;
}
void CBaseAnimating::DisableServerIK()
{
delete m_pIk;
m_pIk = NULL;
m_bUseIks = false;
}
Activity CBaseAnimating::GetSequenceActivity( int iSequence )

View file

@ -424,6 +424,7 @@ protected:
public:
COutputEvent m_OnIgnite;
CNetworkVar( bool, m_bUseIks );
protected:
CStudioHdr *m_pStudioHdr;

View file

@ -427,6 +427,11 @@ public:
const Vector& GetAbsOrigin( void ) const;
const QAngle& GetAbsAngles( void ) const;
virtual const QAngle& GetRenderAngles( void )
{
return GetAbsAngles();
}
SolidType_t GetSolid() const;
int GetSolidFlags( void ) const;

View file

@ -302,6 +302,7 @@ IMPLEMENT_SERVERCLASS_ST( CCSPlayer, DT_CSPlayer )
SendPropInt( SENDINFO( m_iClass ), Q_log2( CS_NUM_CLASSES )+1, SPROP_UNSIGNED ),
SendPropInt( SENDINFO( m_ArmorValue ), 8 ),
SendPropQAngles(SENDINFO(m_angEyeAngles)),
SendPropQAngles(SENDINFO(m_angRenderAngles)),
SendPropBool( SENDINFO( m_bHasDefuser ) ),
SendPropBool( SENDINFO( m_bNightVisionOn ) ), //send as int so we can use a RecvProxy on the client
SendPropBool( SENDINFO( m_bHasNightVision ) ),
@ -1589,7 +1590,7 @@ void CCSPlayer::PostThink()
m_PlayerAnimState->Update( m_angEyeAngles[YAW], m_angEyeAngles[PITCH] );
// Use the m_angRotation instead.
SetLocalAngles( m_PlayerAnimState->GetRenderAngles() );
m_angRenderAngles = m_PlayerAnimState->GetRenderAngles();
// check if we need to apply a deafness DSP effect.
if ((m_applyDeafnessTime != 0.0f) && (m_applyDeafnessTime <= gpGlobals->curtime))

View file

@ -245,6 +245,8 @@ public:
static CCSPlayer *CreatePlayer( const char *className, edict_t *ed );
static CCSPlayer* Instance( int iEnt );
virtual const QAngle& GetRenderAngles( void );
virtual void Precache();
virtual void Spawn();
virtual void InitialSpawn( void );
@ -814,6 +816,7 @@ public:
// Copyed from EyeAngles() so we can send it to the client.
CNetworkQAngle( m_angEyeAngles );
CNetworkQAngle( m_angRenderAngles );
bool m_bVCollisionInitted;

View file

@ -35,7 +35,7 @@
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
#define HOSTAGE_THINK_INTERVAL 0.1f
#define HOSTAGE_THINK_INTERVAL gpGlobals->interval_per_tick
#define DrawLine( from, to, duration, red, green, blue ) NDebugOverlay::Line( from, to, red, green, blue, true, 0.1f )
#define HOSTAGE_PUSHAWAY_THINK_CONTEXT "HostagePushawayThink"
@ -75,8 +75,7 @@ BEGIN_DATADESC( CHostage )
DEFINE_INPUTFUNC( FIELD_VOID, "OnRescueZoneTouch", HostageRescueZoneTouch ),
DEFINE_USEFUNC( HostageUse ),
DEFINE_THINKFUNC( HostageThink ),
DEFINE_USEFUNC( HostageUse )
END_DATADESC()
@ -104,6 +103,8 @@ CHostage::CHostage()
g_Hostages.AddToTail( this );
m_PlayerAnimState = CreateHostageAnimState( this, this, LEGANIM_8WAY, false );
SetBloodColor( BLOOD_COLOR_RED );
// TODO_ENHANCED: Get IK working on the steep slopes CS has, then enable it on characters.
DisableServerIK();
}
//-----------------------------------------------------------------------------------------------------
@ -860,15 +861,8 @@ void CHostage::HostageThink( void )
// set animation to idle for now
StudioFrameAdvance();
int sequence = SelectWeightedSequence( ACT_IDLE );
if (GetSequence() != sequence)
{
SetSequence( sequence );
}
m_PlayerAnimState->Update( GetAbsAngles()[YAW], GetAbsAngles()[PITCH] );
if ( m_disappearTime && m_disappearTime < gpGlobals->curtime )
{
// finished fading - remove us completely

View file

@ -18,6 +18,9 @@
#include "util.h"
#include "utllinkedlist.h"
#include "BaseAnimatingOverlay.h"
#ifdef CSTRIKE_DLL
#include "cs_player.h"
#endif
#include "tier0/vprof.h"
// memdbgon must be the last include file in a .cpp file!!!
@ -75,6 +78,9 @@ struct LagRecord
float m_masterCycle;
float m_poseParameters[MAXSTUDIOPOSEPARAM];
float m_encodedControllers[MAXSTUDIOBONECTRLS];
#ifdef CSTRIKE_DLL
QAngle m_angRenderAngles;
#endif
};
//
@ -224,6 +230,15 @@ void CLagCompensationManager::TrackEntities()
}
}
#ifdef CSTRIKE_DLL
auto csPlayer = dynamic_cast<CCSPlayer*>(pEntity);
if (csPlayer)
{
record.m_angRenderAngles = csPlayer->GetRenderAngles();
}
#endif
track->Push( record );
}
}
@ -560,6 +575,16 @@ inline void CLagCompensationManager::BacktrackEntity( CBaseEntity* pEntity, int
flags |= LC_ANIM_OVERS_CHANGED;
}
#ifdef CSTRIKE_DLL
auto csPlayer = dynamic_cast<CCSPlayer*>(pEntity);
if (csPlayer && foundAnim)
{
restore->m_angRenderAngles = csPlayer->GetRenderAngles();
csPlayer->m_angRenderAngles = recordAnim->m_angRenderAngles;
}
#endif
Finish();
}
@ -662,6 +687,13 @@ void CLagCompensationManager::FinishLagCompensation( CBasePlayer* player )
}
}
auto csPlayer = dynamic_cast<CCSPlayer*>(pEntity);
if (csPlayer)
{
csPlayer->m_angRenderAngles = restore->m_angRenderAngles;
}
pEntity->SetSimulationTime( restore->m_flSimulationTime );
pEntity->SetAnimTime( restore->m_flAnimTime );
}

View file

@ -44,6 +44,22 @@
ConVar weapon_accuracy_nospread( "weapon_accuracy_nospread", "0", FCVAR_REPLICATED );
#define CS_MASK_SHOOT (MASK_SOLID|CONTENTS_DEBRIS)
const QAngle& CCSPlayer::GetRenderAngles()
{
#ifdef CLIENT_DLL
if ( IsRagdoll() )
{
return vec3_angle;
}
else
{
return m_angRenderAngles;
}
#else
return m_angRenderAngles;
#endif
}
void DispatchEffect( const char *pName, const CEffectData &data );
#ifdef _DEBUG
@ -558,7 +574,7 @@ void CCSPlayer::FireBullet(
QAngle angles[MAXSTUDIOBONES];
int indexes[MAXSTUDIOBONES];
auto angle = lagPlayer->GetLocalAngles();
auto angle = lagPlayer->GetRenderAngles();
auto position = lagPlayer->GetLocalOrigin();
event->SetFloat( "position_x", position.x );

View file

@ -319,8 +319,8 @@ void FX_FireBullets(
C_CSPlayer::HitboxRecord record;
record.m_vecLocalOrigin = lagPlayer->GetLocalOrigin();
record.m_angLocalAngles = lagPlayer->GetLocalAngles();
record.m_vecLocalOrigin = lagPlayer->GetLocalOrigin();
record.m_angLocalAngles = lagPlayer->GetRenderAngles();
record.m_nAttackerTickBase = pPlayer->m_nTickBase;
record.m_flSimulationTime = lagPlayer->m_flInterpolatedSimulationTime;