Use client side animation for hostages for now
Also added GetSkeleton for animating overlay
This commit is contained in:
parent
35b1d272a0
commit
7028c910e7
5 changed files with 80 additions and 8 deletions
|
@ -8,6 +8,7 @@
|
|||
#include "cbase.h"
|
||||
#include "c_baseanimatingoverlay.h"
|
||||
#include "bone_setup.h"
|
||||
#include "studio.h"
|
||||
#include "tier0/vprof.h"
|
||||
#include "engine/ivdebugoverlay.h"
|
||||
#include "datacache/imdlcache.h"
|
||||
|
@ -566,3 +567,66 @@ CStudioHdr *C_BaseAnimatingOverlay::OnNewModel()
|
|||
|
||||
return hdr;
|
||||
}
|
||||
|
||||
void C_BaseAnimatingOverlay::GetSkeleton( CStudioHdr* pStudioHdr, Vector pos[], Quaternion q[], int boneMask, float currentTime )
|
||||
{
|
||||
if(!pStudioHdr)
|
||||
{
|
||||
Assert(!"C_BaseAnimating::GetSkeleton() without a model");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!pStudioHdr->SequencesAvailable())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
float poseparameters[MAXSTUDIOPOSEPARAM];
|
||||
GetPoseParameters(pStudioHdr, poseparameters);
|
||||
|
||||
IBoneSetup boneSetup( pStudioHdr, boneMask, poseparameters );
|
||||
boneSetup.InitPose( pos, q );
|
||||
|
||||
boneSetup.AccumulatePose( pos, q, GetSequence(), GetCycle(), 1.0, currentTime, m_pIk );
|
||||
|
||||
// sort the layers
|
||||
int layer[MAX_OVERLAYS] = {};
|
||||
int i;
|
||||
for (i = 0; i < m_AnimOverlay.Count(); i++)
|
||||
{
|
||||
layer[i] = MAX_OVERLAYS;
|
||||
}
|
||||
for (i = 0; i < m_AnimOverlay.Count(); i++)
|
||||
{
|
||||
CAnimationLayer &pLayer = m_AnimOverlay[i];
|
||||
if( (pLayer.m_flWeight > 0) && pLayer.IsActive() && pLayer.m_nOrder >= 0 && pLayer.m_nOrder < m_AnimOverlay.Count())
|
||||
{
|
||||
layer[pLayer.m_nOrder] = i;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < m_AnimOverlay.Count(); i++)
|
||||
{
|
||||
if (layer[i] >= 0 && layer[i] < m_AnimOverlay.Count())
|
||||
{
|
||||
CAnimationLayer &pLayer = m_AnimOverlay[layer[i]];
|
||||
// UNDONE: Is it correct to use overlay weight for IK too?
|
||||
boneSetup.AccumulatePose( pos, q, pLayer.m_nSequence, pLayer.m_flCycle, pLayer.m_flWeight, currentTime, m_pIk );
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_pIk )
|
||||
{
|
||||
CIKContext auto_ik;
|
||||
auto_ik.Init( pStudioHdr, GetRenderAngles(), GetRenderOrigin(), currentTime, 0, boneMask );
|
||||
boneSetup.CalcAutoplaySequences( pos, q, currentTime, &auto_ik );
|
||||
}
|
||||
else
|
||||
{
|
||||
boneSetup.CalcAutoplaySequences(pos, q, currentTime, NULL);
|
||||
}
|
||||
|
||||
float controllers[MAXSTUDIOBONECTRLS];
|
||||
GetBoneControllers(controllers);
|
||||
|
||||
boneSetup.CalcBoneAdj( pos, q, controllers );
|
||||
}
|
|
@ -40,6 +40,7 @@ public:
|
|||
// model specific
|
||||
virtual void AccumulateLayers( IBoneSetup &boneSetup, Vector pos[], Quaternion q[], float currentTime );
|
||||
virtual void DoAnimationEvents( CStudioHdr *pStudioHdr );
|
||||
virtual void GetSkeleton( CStudioHdr *pStudioHdr, Vector pos[], Quaternion q[], int boneMask, float currentTime );
|
||||
|
||||
enum
|
||||
{
|
||||
|
|
|
@ -103,7 +103,9 @@ CHostage::CHostage()
|
|||
{
|
||||
g_Hostages.AddToTail( this );
|
||||
m_PlayerAnimState = CreateHostageAnimState( this, this, LEGANIM_8WAY, false );
|
||||
// UseClientSideAnimation();
|
||||
|
||||
// ENHANCED_TODO: remove this
|
||||
UseClientSideAnimation();
|
||||
SetBloodColor( BLOOD_COLOR_RED );
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
//=============================================================================//
|
||||
|
||||
#include "cbase.h"
|
||||
#include "icvar.h"
|
||||
#include "usercmd.h"
|
||||
#include "igamesystem.h"
|
||||
#include "ilagcompensationmanager.h"
|
||||
|
@ -824,13 +825,17 @@ void CLagCompensationManager::BacktrackPlayer( CBasePlayer *pPlayer, CUserCmd *c
|
|||
restore->m_fFlags = flags; // we need to restore these flags
|
||||
change->m_fFlags = flags; // we have changed these flags
|
||||
|
||||
if( sv_showlagcompensation.GetInt() == 1 )
|
||||
if( sv_showlagcompensation.GetInt() == pPlayer->entindex() )
|
||||
{
|
||||
pPlayer->DrawServerHitboxes(4, true);
|
||||
pPlayer->DrawServerHitboxes(60, false);
|
||||
}
|
||||
|
||||
DevMsg("Server: %s => %f %f %f => %f (frac: %f)\n", pPlayer->GetPlayerName(), change->m_vecOrigin.x, change->m_vecOrigin.y, change->m_vecOrigin.z, flTargetSimulationTime, fracSim);
|
||||
static ConVar *sv_showplayerhitboxes = g_pCVar->FindVar("sv_showplayerhitboxes");
|
||||
|
||||
if ( sv_showplayerhitboxes->GetInt() == pPlayer->entindex() )
|
||||
{
|
||||
DevMsg("Server: %s => %f %f %f => %f (frac: %f)\n", pPlayer->GetPlayerName(), change->m_vecOrigin.x, change->m_vecOrigin.y, change->m_vecOrigin.z, flTargetSimulationTime, fracSim);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -416,11 +416,11 @@ void CCSPlayer::FireBullet(
|
|||
if( lagPlayer )
|
||||
{
|
||||
#ifdef CLIENT_DLL
|
||||
lagPlayer->DrawClientHitboxes(4, true);
|
||||
DevMsg("Client: %s => %f %f %f => %f\n", lagPlayer->GetPlayerName(), lagPlayer->GetAbsOrigin().x, lagPlayer->GetAbsOrigin().y, lagPlayer->GetAbsOrigin().z,
|
||||
lagPlayer->m_flInterpolatedSimulationTime);
|
||||
lagPlayer->DrawClientHitboxes(60, true);
|
||||
DevMsg("Client: %s => %f %f %f => %f (%f)\n", lagPlayer->GetPlayerName(), lagPlayer->GetAbsOrigin().x, lagPlayer->GetAbsOrigin().y, lagPlayer->GetAbsOrigin().z,
|
||||
lagPlayer->m_flInterpolatedSimulationTime, fmod(lagPlayer->m_flInterpolatedSimulationTime, TICK_INTERVAL) / TICK_INTERVAL);
|
||||
#else
|
||||
lagPlayer->DrawServerHitboxes(4, true);
|
||||
lagPlayer->DrawServerHitboxes(60, true);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue