diff options
| author | Jørgen P. Tjernø <[email protected]> | 2013-12-02 19:31:46 -0800 |
|---|---|---|
| committer | Jørgen P. Tjernø <[email protected]> | 2013-12-02 19:46:31 -0800 |
| commit | f56bb35301836e56582a575a75864392a0177875 (patch) | |
| tree | de61ddd39de3e7df52759711950b4c288592f0dc /mp/src/game/shared/death_pose.cpp | |
| parent | Mark some more files as text. (diff) | |
| download | source-sdk-2013-f56bb35301836e56582a575a75864392a0177875.tar.xz source-sdk-2013-f56bb35301836e56582a575a75864392a0177875.zip | |
Fix line endings. WHAMMY.
Diffstat (limited to 'mp/src/game/shared/death_pose.cpp')
| -rw-r--r-- | mp/src/game/shared/death_pose.cpp | 332 |
1 files changed, 166 insertions, 166 deletions
diff --git a/mp/src/game/shared/death_pose.cpp b/mp/src/game/shared/death_pose.cpp index 5c52838c..866717e8 100644 --- a/mp/src/game/shared/death_pose.cpp +++ b/mp/src/game/shared/death_pose.cpp @@ -1,166 +1,166 @@ -//========= Copyright Valve Corporation, All rights reserved. ============//
-//
-// Purpose:
-//
-//=============================================================================
-
-#include "cbase.h"
-#include "death_pose.h"
-
-#ifdef CLIENT_DLL
-
-void GetRagdollCurSequenceWithDeathPose( C_BaseAnimating *entity, matrix3x4_t *curBones, float flTime, int activity, int frame )
-{
- // blow the cached prev bones
- entity->InvalidateBoneCache();
-
- Vector vPrevOrigin = entity->GetAbsOrigin();
-
- entity->Interpolate( flTime );
-
- if ( activity != ACT_INVALID )
- {
- Vector vNewOrigin = entity->GetAbsOrigin();
- Vector vDirection = vNewOrigin - vPrevOrigin;
-
- float flVelocity = VectorNormalize( vDirection );
-
- Vector vAdjustedOrigin = vNewOrigin + vDirection * ( ( flVelocity * flVelocity ) * gpGlobals->frametime );
-
- int iTempSequence = entity->GetSequence();
- float flTempCycle = entity->GetCycle();
-
- entity->SetSequence( activity );
-
- entity->SetCycle( (float)frame / MAX_DEATHPOSE_FRAMES );
-
- entity->SetAbsOrigin( vAdjustedOrigin );
-
- // Now do the current bone setup
- entity->SetupBones( curBones, MAXSTUDIOBONES, BONE_USED_BY_ANYTHING, flTime );
-
- entity->SetAbsOrigin( vNewOrigin );
-
- // blow the cached prev bones
- entity->InvalidateBoneCache();
-
- entity->SetSequence( iTempSequence );
- entity->SetCycle( flTempCycle );
-
- entity->Interpolate( gpGlobals->curtime );
-
- entity->SetupBones( NULL, -1, BONE_USED_BY_ANYTHING, gpGlobals->curtime );
- }
- else
- {
- entity->SetupBones( curBones, MAXSTUDIOBONES, BONE_USED_BY_ANYTHING, flTime );
-
- // blow the cached prev bones
- entity->InvalidateBoneCache();
-
- entity->SetupBones( NULL, -1, BONE_USED_BY_ANYTHING, flTime );
- }
-}
-
-#else // !CLIENT_DLL
-
-Activity GetDeathPoseActivity( CBaseAnimating *entity, const CTakeDamageInfo &info )
-{
- if ( !entity )
- {
- return ACT_INVALID;
- }
-
- Activity aActivity;
-
- Vector vForward, vRight;
- entity->GetVectors( &vForward, &vRight, NULL );
-
- Vector vDir = -info.GetDamageForce();
- VectorNormalize( vDir );
-
- float flDotForward = DotProduct( vForward, vDir );
- float flDotRight = DotProduct( vRight, vDir );
-
- bool bNegativeForward = false;
- bool bNegativeRight = false;
-
- if ( flDotForward < 0.0f )
- {
- bNegativeForward = true;
- flDotForward = flDotForward * -1;
- }
-
- if ( flDotRight < 0.0f )
- {
- bNegativeRight = true;
- flDotRight = flDotRight * -1;
- }
-
- if ( flDotRight > flDotForward )
- {
- if ( bNegativeRight == true )
- aActivity = ACT_DIE_LEFTSIDE;
- else
- aActivity = ACT_DIE_RIGHTSIDE;
- }
- else
- {
- if ( bNegativeForward == true )
- aActivity = ACT_DIE_BACKSIDE;
- else
- aActivity = ACT_DIE_FRONTSIDE;
- }
-
- return aActivity;
-}
-
-void SelectDeathPoseActivityAndFrame( CBaseAnimating *entity, const CTakeDamageInfo &info, int hitgroup, Activity& activity, int& frame )
-{
- activity = ACT_INVALID;
- frame = 0;
-
- if ( !entity->GetModelPtr() )
- return;
-
- activity = GetDeathPoseActivity( entity, info );
- frame = DEATH_FRAME_HEAD;
-
- switch( hitgroup )
- {
- //Do normal ragdoll stuff if no specific hitgroup was hit.
- case HITGROUP_GENERIC:
- default:
- {
- return;
- }
-
- case HITGROUP_HEAD:
- {
- frame = DEATH_FRAME_HEAD;
- break;
- }
- case HITGROUP_LEFTARM:
- frame = DEATH_FRAME_LEFTARM;
- break;
-
- case HITGROUP_RIGHTARM:
- frame = DEATH_FRAME_RIGHTARM;
- break;
-
- case HITGROUP_CHEST:
- case HITGROUP_STOMACH:
- frame = DEATH_FRAME_STOMACH;
- break;
-
- case HITGROUP_LEFTLEG:
- frame = DEATH_FRAME_LEFTLEG;
- break;
-
- case HITGROUP_RIGHTLEG:
- frame = DEATH_FRAME_RIGHTLEG;
- break;
- }
-}
-
-#endif // !CLIENT_DLL
+//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +//============================================================================= + +#include "cbase.h" +#include "death_pose.h" + +#ifdef CLIENT_DLL + +void GetRagdollCurSequenceWithDeathPose( C_BaseAnimating *entity, matrix3x4_t *curBones, float flTime, int activity, int frame ) +{ + // blow the cached prev bones + entity->InvalidateBoneCache(); + + Vector vPrevOrigin = entity->GetAbsOrigin(); + + entity->Interpolate( flTime ); + + if ( activity != ACT_INVALID ) + { + Vector vNewOrigin = entity->GetAbsOrigin(); + Vector vDirection = vNewOrigin - vPrevOrigin; + + float flVelocity = VectorNormalize( vDirection ); + + Vector vAdjustedOrigin = vNewOrigin + vDirection * ( ( flVelocity * flVelocity ) * gpGlobals->frametime ); + + int iTempSequence = entity->GetSequence(); + float flTempCycle = entity->GetCycle(); + + entity->SetSequence( activity ); + + entity->SetCycle( (float)frame / MAX_DEATHPOSE_FRAMES ); + + entity->SetAbsOrigin( vAdjustedOrigin ); + + // Now do the current bone setup + entity->SetupBones( curBones, MAXSTUDIOBONES, BONE_USED_BY_ANYTHING, flTime ); + + entity->SetAbsOrigin( vNewOrigin ); + + // blow the cached prev bones + entity->InvalidateBoneCache(); + + entity->SetSequence( iTempSequence ); + entity->SetCycle( flTempCycle ); + + entity->Interpolate( gpGlobals->curtime ); + + entity->SetupBones( NULL, -1, BONE_USED_BY_ANYTHING, gpGlobals->curtime ); + } + else + { + entity->SetupBones( curBones, MAXSTUDIOBONES, BONE_USED_BY_ANYTHING, flTime ); + + // blow the cached prev bones + entity->InvalidateBoneCache(); + + entity->SetupBones( NULL, -1, BONE_USED_BY_ANYTHING, flTime ); + } +} + +#else // !CLIENT_DLL + +Activity GetDeathPoseActivity( CBaseAnimating *entity, const CTakeDamageInfo &info ) +{ + if ( !entity ) + { + return ACT_INVALID; + } + + Activity aActivity; + + Vector vForward, vRight; + entity->GetVectors( &vForward, &vRight, NULL ); + + Vector vDir = -info.GetDamageForce(); + VectorNormalize( vDir ); + + float flDotForward = DotProduct( vForward, vDir ); + float flDotRight = DotProduct( vRight, vDir ); + + bool bNegativeForward = false; + bool bNegativeRight = false; + + if ( flDotForward < 0.0f ) + { + bNegativeForward = true; + flDotForward = flDotForward * -1; + } + + if ( flDotRight < 0.0f ) + { + bNegativeRight = true; + flDotRight = flDotRight * -1; + } + + if ( flDotRight > flDotForward ) + { + if ( bNegativeRight == true ) + aActivity = ACT_DIE_LEFTSIDE; + else + aActivity = ACT_DIE_RIGHTSIDE; + } + else + { + if ( bNegativeForward == true ) + aActivity = ACT_DIE_BACKSIDE; + else + aActivity = ACT_DIE_FRONTSIDE; + } + + return aActivity; +} + +void SelectDeathPoseActivityAndFrame( CBaseAnimating *entity, const CTakeDamageInfo &info, int hitgroup, Activity& activity, int& frame ) +{ + activity = ACT_INVALID; + frame = 0; + + if ( !entity->GetModelPtr() ) + return; + + activity = GetDeathPoseActivity( entity, info ); + frame = DEATH_FRAME_HEAD; + + switch( hitgroup ) + { + //Do normal ragdoll stuff if no specific hitgroup was hit. + case HITGROUP_GENERIC: + default: + { + return; + } + + case HITGROUP_HEAD: + { + frame = DEATH_FRAME_HEAD; + break; + } + case HITGROUP_LEFTARM: + frame = DEATH_FRAME_LEFTARM; + break; + + case HITGROUP_RIGHTARM: + frame = DEATH_FRAME_RIGHTARM; + break; + + case HITGROUP_CHEST: + case HITGROUP_STOMACH: + frame = DEATH_FRAME_STOMACH; + break; + + case HITGROUP_LEFTLEG: + frame = DEATH_FRAME_LEFTLEG; + break; + + case HITGROUP_RIGHTLEG: + frame = DEATH_FRAME_RIGHTLEG; + break; + } +} + +#endif // !CLIENT_DLL |