Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 26 additions & 23 deletions src/game/server/baseanimating.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1556,7 +1556,7 @@ void CBaseAnimating::GetBoneTransform( int iBone, matrix3x4_t &pBoneToWorld )
return;
}

CBoneCache *pcache = GetBoneCache( );
CBoneCache *pcache = GetBoneCache( pStudioHdr );

matrix3x4_t *pmatrix = pcache->GetCachedBone( iBone );

Expand Down Expand Up @@ -1941,26 +1941,30 @@ void CBaseAnimating::SetupBones( matrix3x4_t *pBoneToWorld, int boneMask )
CBaseAnimating *pParent = dynamic_cast< CBaseAnimating* >( GetMoveParent() );
if ( pParent )
{
// We're doing bone merging, so do special stuff here.
CBoneCache *pParentCache = pParent->GetBoneCache();
if ( pParentCache )
CStudioHdr* pParentHdr = pParent->GetModelPtr();
if ( pParentHdr )
{
BuildMatricesWithBoneMerge(
pStudioHdr,
GetAbsAngles(),
adjOrigin,
pos,
q,
pBoneToWorld,
pParent,
pParentCache );

RemoveEFlags( EFL_SETTING_UP_BONES );
if (ai_setupbones_debug.GetBool())
// We're doing bone merging, so do special stuff here.
CBoneCache *pParentCache = pParent->GetBoneCache( pParentHdr );
if ( pParentCache )
{
DrawRawSkeleton( pBoneToWorld, boneMask, true, 0.11 );
BuildMatricesWithBoneMerge(
pStudioHdr,
GetAbsAngles(),
adjOrigin,
pos,
q,
pBoneToWorld,
pParent,
pParentCache );

RemoveEFlags( EFL_SETTING_UP_BONES );
if (ai_setupbones_debug.GetBool())
{
DrawRawSkeleton( pBoneToWorld, boneMask, true, 0.11 );
}
return;
}
return;
}
}

Expand Down Expand Up @@ -2747,9 +2751,8 @@ void CBaseAnimating::UnlockStudioHdr()
// Purpose: return the index to the shared bone cache
// Output :
//-----------------------------------------------------------------------------
CBoneCache *CBaseAnimating::GetBoneCache( void )
CBoneCache *CBaseAnimating::GetBoneCache( CStudioHdr* pStudioHdr )
{
CStudioHdr *pStudioHdr = GetModelPtr( );
Assert(pStudioHdr);

CBoneCache *pcache = Studio_GetBoneCache( m_boneCacheHandle );
Expand Down Expand Up @@ -2846,7 +2849,7 @@ bool CBaseAnimating::TestHitboxes( const Ray_t &ray, unsigned int fContentsMask,
if ( !set || !set->numhitboxes )
return false;

CBoneCache *pcache = GetBoneCache( );
CBoneCache *pcache = GetBoneCache( pStudioHdr );

matrix3x4_t *hitboxbones[MAXSTUDIOBONES];
pcache->ReadCachedBonePointers( hitboxbones, pStudioHdr->numbones() );
Expand Down Expand Up @@ -3257,7 +3260,7 @@ bool CBaseAnimating::ComputeHitboxSurroundingBox( Vector *pVecWorldMins, Vector
if ( !set || !set->numhitboxes )
return false;

CBoneCache *pCache = GetBoneCache();
CBoneCache *pCache = GetBoneCache( pStudioHdr );

// Compute a box in world space that surrounds this entity
pVecWorldMins->Init( FLT_MAX, FLT_MAX, FLT_MAX );
Expand Down Expand Up @@ -3297,7 +3300,7 @@ bool CBaseAnimating::ComputeEntitySpaceHitboxSurroundingBox( Vector *pVecWorldMi
if ( !set || !set->numhitboxes )
return false;

CBoneCache *pCache = GetBoneCache();
CBoneCache *pCache = GetBoneCache( pStudioHdr );
matrix3x4_t *hitboxbones[MAXSTUDIOBONES];
pCache->ReadCachedBonePointers( hitboxbones, pStudioHdr->numbones() );

Expand Down
2 changes: 1 addition & 1 deletion src/game/server/baseanimating.h
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ class CBaseAnimating : public CBaseEntity
void ReportMissingActivity( int iActivity );
virtual bool TestCollision( const Ray_t &ray, unsigned int fContentsMask, trace_t& tr );
virtual bool TestHitboxes( const Ray_t &ray, unsigned int fContentsMask, trace_t& tr );
class CBoneCache *GetBoneCache( void );
class CBoneCache *GetBoneCache( CStudioHdr* pStudioHdr );
void InvalidateBoneCache();
void InvalidateBoneCacheIfOlderThan( float deltaTime );
virtual int DrawDebugTextOverlays( void );
Expand Down
2 changes: 1 addition & 1 deletion src/game/server/tf/tf_projectile_arrow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ bool CTFProjectile_Arrow::PositionArrowOnBone( mstudiobbox_t *pBox, CBaseAnimati
if ( pBox->bone < 0 || pBox->bone >= pStudioHdr->numbones() ) // Bone index must be valid.
return false;

CBoneCache *pCache = pOtherAnim->GetBoneCache();
CBoneCache *pCache = pOtherAnim->GetBoneCache( pStudioHdr );
if ( !pCache )
return false;

Expand Down
2 changes: 1 addition & 1 deletion src/game/shared/tf/tf_weapon_jar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ bool CTFProjectile_Jar::PositionArrowOnBone( mstudiobbox_t *pBox, CBaseAnimating
if ( pBox->bone < 0 || pBox->bone >= pStudioHdr->numbones() ) // Bone index must be valid.
return false;

CBoneCache *pCache = pOtherAnim->GetBoneCache();
CBoneCache *pCache = pOtherAnim->GetBoneCache( pStudioHdr );
if ( !pCache )
return false;

Expand Down