mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2024-12-26 06:45:31 +03:00
Enhancements for interactions which don't test angles (including a new pose parameter to change animations based on angle)
This commit is contained in:
parent
fd149ff161
commit
a88091a4d9
@ -3026,6 +3026,10 @@ void CAI_BaseNPC::PopulatePoseParameters( void )
|
|||||||
m_poseAim_Yaw = LookupPoseParameter( "aim_yaw" );
|
m_poseAim_Yaw = LookupPoseParameter( "aim_yaw" );
|
||||||
m_poseMove_Yaw = LookupPoseParameter( "move_yaw" );
|
m_poseMove_Yaw = LookupPoseParameter( "move_yaw" );
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
m_poseInteractionRelativeYaw = LookupPoseParameter( "interaction_relative_yaw" );
|
||||||
|
#endif
|
||||||
|
|
||||||
BaseClass::PopulatePoseParameters();
|
BaseClass::PopulatePoseParameters();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -15370,6 +15374,26 @@ void CAI_BaseNPC::StartScriptedNPCInteraction( CAI_BaseNPC *pOtherNPC, ScriptedN
|
|||||||
|
|
||||||
// Tell their sequence to keep their position relative to me
|
// Tell their sequence to keep their position relative to me
|
||||||
pTheirSequence->SetupInteractionPosition( this, pInteraction->matDesiredLocalToWorld );
|
pTheirSequence->SetupInteractionPosition( this, pInteraction->matDesiredLocalToWorld );
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
if ( !(pInteraction->iFlags & SCNPC_FLAG_TEST_OTHER_ANGLES) )
|
||||||
|
{
|
||||||
|
// Set up interaction yaw pose if it exists
|
||||||
|
float flYaw = AngleDistance( angDesired.y, angOtherAngles.y );
|
||||||
|
|
||||||
|
int nInteractionPose = LookupPoseInteractionRelativeYaw();
|
||||||
|
if (nInteractionPose > -1)
|
||||||
|
{
|
||||||
|
SetPoseParameter( nInteractionPose, flYaw );
|
||||||
|
}
|
||||||
|
|
||||||
|
nInteractionPose = pOtherNPC->LookupPoseInteractionRelativeYaw();
|
||||||
|
if (nInteractionPose > -1)
|
||||||
|
{
|
||||||
|
pOtherNPC->SetPoseParameter( nInteractionPose, flYaw );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Spawn both sequences at once
|
// Spawn both sequences at once
|
||||||
@ -16022,6 +16046,13 @@ bool CAI_BaseNPC::InteractionCouldStart( CAI_BaseNPC *pOtherNPC, ScriptedNPCInte
|
|||||||
anglemod(angEnemyAngles.x), anglemod(angEnemyAngles.y), anglemod(angEnemyAngles.z), anglemod(angAngles.x), anglemod(angAngles.y), anglemod(angAngles.z) );
|
anglemod(angEnemyAngles.x), anglemod(angEnemyAngles.y), anglemod(angEnemyAngles.z), anglemod(angAngles.x), anglemod(angAngles.y), anglemod(angAngles.z) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef MAPBASE
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// If we're not using angles, then use the NPC's current angles
|
||||||
|
angAngles = pOtherNPC->GetAbsAngles();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// TODO: Velocity check, if we're supposed to
|
// TODO: Velocity check, if we're supposed to
|
||||||
if ( pInteraction->iFlags & SCNPC_FLAG_TEST_OTHER_VELOCITY )
|
if ( pInteraction->iFlags & SCNPC_FLAG_TEST_OTHER_VELOCITY )
|
||||||
|
@ -849,6 +849,9 @@ protected: // pose parameters
|
|||||||
int m_poseAim_Pitch;
|
int m_poseAim_Pitch;
|
||||||
int m_poseAim_Yaw;
|
int m_poseAim_Yaw;
|
||||||
int m_poseMove_Yaw;
|
int m_poseMove_Yaw;
|
||||||
|
#ifdef MAPBASE
|
||||||
|
int m_poseInteractionRelativeYaw;
|
||||||
|
#endif
|
||||||
virtual void PopulatePoseParameters( void );
|
virtual void PopulatePoseParameters( void );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -857,6 +860,10 @@ public:
|
|||||||
// Return the stored pose parameter for "move_yaw"
|
// Return the stored pose parameter for "move_yaw"
|
||||||
inline int LookupPoseMoveYaw() { return m_poseMove_Yaw; }
|
inline int LookupPoseMoveYaw() { return m_poseMove_Yaw; }
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
inline int LookupPoseInteractionRelativeYaw() { return m_poseInteractionRelativeYaw; }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
//
|
//
|
||||||
|
@ -1610,6 +1610,12 @@ void CAI_BaseNPC::StartTask( const Task_t *pTask )
|
|||||||
// as this should only run with the NPC "receiving" the interaction
|
// as this should only run with the NPC "receiving" the interaction
|
||||||
ScriptedNPCInteraction_t *pInteraction = m_hForcedInteractionPartner->GetRunningDynamicInteraction();
|
ScriptedNPCInteraction_t *pInteraction = m_hForcedInteractionPartner->GetRunningDynamicInteraction();
|
||||||
|
|
||||||
|
if ( !(pInteraction->iFlags & SCNPC_FLAG_TEST_OTHER_ANGLES) )
|
||||||
|
{
|
||||||
|
TaskComplete();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Get our target's origin
|
// Get our target's origin
|
||||||
Vector vecTarget = m_hForcedInteractionPartner->GetAbsOrigin();
|
Vector vecTarget = m_hForcedInteractionPartner->GetAbsOrigin();
|
||||||
|
|
||||||
@ -1617,7 +1623,7 @@ void CAI_BaseNPC::StartTask( const Task_t *pTask )
|
|||||||
float angInteractionAngle = pInteraction->angRelativeAngles.y;
|
float angInteractionAngle = pInteraction->angRelativeAngles.y;
|
||||||
angInteractionAngle += 180.0f;
|
angInteractionAngle += 180.0f;
|
||||||
|
|
||||||
GetMotor()->SetIdealYaw( CalcIdealYaw( vecTarget ) + angInteractionAngle );
|
GetMotor()->SetIdealYaw( AngleNormalize( CalcIdealYaw( vecTarget ) + angInteractionAngle ) );
|
||||||
|
|
||||||
if (FacingIdeal())
|
if (FacingIdeal())
|
||||||
TaskComplete();
|
TaskComplete();
|
||||||
@ -4113,6 +4119,15 @@ void CAI_BaseNPC::RunTask( const Task_t *pTask )
|
|||||||
m_hCine->SynchronizeSequence( this );
|
m_hCine->SynchronizeSequence( this );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
if ( IsRunningDynamicInteraction() && m_poseInteractionRelativeYaw > -1 )
|
||||||
|
{
|
||||||
|
// Animations in progress require pose parameters to be set every frame, so keep setting the interaction relative yaw pose.
|
||||||
|
// The random value is added to help it pass server transmit checks.
|
||||||
|
SetPoseParameter( m_poseInteractionRelativeYaw, GetPoseParameter( m_poseInteractionRelativeYaw ) + RandomFloat( -0.1f, 0.1f ) );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user