mirror of
https://github.com/nillerusr/source-engine.git
synced 2026-08-31 06:29:20 +00:00
upload "kind" alien swarm
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
@@ -53,7 +53,7 @@ struct AI_Follower_t
|
||||
}
|
||||
|
||||
AIHANDLE hFollower;
|
||||
intp slot;
|
||||
int slot;
|
||||
AI_FollowNavInfo_t navInfo;
|
||||
AI_FollowGroup_t * pGroup; // backpointer for efficiency
|
||||
};
|
||||
@@ -111,7 +111,7 @@ public:
|
||||
else
|
||||
{
|
||||
int result = 0;
|
||||
for ( intp i = pGroup->followers.Head(); i != pGroup->followers.InvalidIndex(); i = pGroup->followers.Next( i ) )
|
||||
for ( int i = pGroup->followers.Head(); i != pGroup->followers.InvalidIndex(); i = pGroup->followers.Next( i ) )
|
||||
{
|
||||
if ( pGroup->followers[i].hFollower && pGroup->followers[i].hFollower->ClassMatches( iszClassname ) )
|
||||
{
|
||||
@@ -131,7 +131,7 @@ public:
|
||||
return 0;
|
||||
}
|
||||
|
||||
intp h = pGroup->followers.Head();
|
||||
int h = pGroup->followers.Head();
|
||||
|
||||
while( h != pGroup->followers.InvalidIndex() )
|
||||
{
|
||||
@@ -543,7 +543,7 @@ bool CAI_FollowBehavior::IsFollowGoalInRange( float tolerance, float zTolerance,
|
||||
// Increase Z tolerance slightly as XY distance decreases
|
||||
float flToleranceSq = (tolerance*tolerance);
|
||||
float flIncreaseRange = flToleranceSq * 0.25;
|
||||
zTolerance += zTolerance * clamp((distanceSq / flIncreaseRange), 0.f, 1.f );
|
||||
zTolerance += zTolerance * clamp((distanceSq / flIncreaseRange), 0, 1 );
|
||||
if ( fabs( origin.z - goal.z ) > zTolerance )
|
||||
return false;
|
||||
|
||||
@@ -2483,6 +2483,38 @@ static AI_FollowFormation_t g_HunterFollowFormation =
|
||||
g_HunterFollowFormationSlots,
|
||||
};
|
||||
|
||||
//-------------------------------------
|
||||
// Infested used this for marines in Follow order mode
|
||||
//-------------------------------------
|
||||
// follow tolerances
|
||||
#define ASW_TIGHT_MIN 60
|
||||
#define ASW_TIGHT_MAX 80
|
||||
#define ASW_TIGHT_TOL 48
|
||||
static AI_FollowSlot_t g_TopDownTightFollowFormationSlots[] =
|
||||
{
|
||||
// asw version
|
||||
{ 1, { 0, 0, 0 }, 0, ASW_TIGHT_MIN, ASW_TIGHT_MAX, ASW_TIGHT_TOL },
|
||||
{ 1, { 0, 0, 0 }, 0, ASW_TIGHT_MIN, ASW_TIGHT_MAX, ASW_TIGHT_TOL },
|
||||
{ 1, { 0, 0, 0 }, 0, ASW_TIGHT_MIN, ASW_TIGHT_MAX, ASW_TIGHT_TOL },
|
||||
{ 1, { 0, 0, 0 }, 0, ASW_TIGHT_MIN, ASW_TIGHT_MAX, ASW_TIGHT_TOL },
|
||||
};
|
||||
|
||||
static AI_FollowFormation_t g_TopDownTightFollowFormation =
|
||||
{
|
||||
"TopDownTight",
|
||||
AIFF_DEFAULT | AIFF_USE_FOLLOW_POINTS,
|
||||
ARRAYSIZE(g_CommanderFollowFormationSlots),
|
||||
48, // followPointTolerance // asw (was 48)
|
||||
6, // targetMoveTolerance // asw was 6
|
||||
60, // repathOnRouteTolerance
|
||||
12, // walkTolerance // asw was 12 - this one seems to let me move a bit before he follows
|
||||
600, // coverTolerance
|
||||
32, // enemyLOSTolerance // asw was 32
|
||||
32, // chaseEnemyTolerance // asw was 32
|
||||
g_WideFollowFormationSlots,
|
||||
//g_TightFollowFormationSlots,
|
||||
};
|
||||
|
||||
|
||||
//-------------------------------------
|
||||
|
||||
@@ -2536,6 +2568,7 @@ AI_FollowFormation_t *g_AI_Formations[] =
|
||||
&g_SidekickFollowFormation,
|
||||
&g_HunterFollowFormation,
|
||||
&g_VortigauntFollowFormation,
|
||||
&g_TopDownTightFollowFormation,
|
||||
};
|
||||
|
||||
AI_FollowFormation_t *AIGetFormation( AI_Formations_t formation )
|
||||
@@ -2561,7 +2594,7 @@ bool CAI_FollowManager::AddFollower( CBaseEntity *pTarget, CAI_BaseNPC *pFollowe
|
||||
|
||||
AI_FollowSlot_t *pSlot = &pGroup->pFormation->pSlots[slot];
|
||||
|
||||
intp i = pGroup->followers.AddToTail( );
|
||||
int i = pGroup->followers.AddToTail( );
|
||||
|
||||
AI_Follower_t *iterNode = &pGroup->followers[i];
|
||||
iterNode->hFollower = pFollower;
|
||||
@@ -2569,8 +2602,9 @@ bool CAI_FollowManager::AddFollower( CBaseEntity *pTarget, CAI_BaseNPC *pFollowe
|
||||
iterNode->pGroup = pGroup;
|
||||
|
||||
pGroup->slotUsage.Set( slot );
|
||||
|
||||
CalculateFieldsFromSlot( pSlot, &iterNode->navInfo );
|
||||
|
||||
|
||||
pHandle->m_hFollower = i;
|
||||
pHandle->m_pGroup = pGroup;
|
||||
return true;
|
||||
@@ -2640,10 +2674,10 @@ bool CAI_FollowManager::RedistributeSlots( AI_FollowGroup_t *pGroup )
|
||||
{
|
||||
AI_FollowSlot_t * pSlot = &pGroup->pFormation->pSlots[bestSlot];
|
||||
Vector slotPos = originFollowed + pSlot->position;
|
||||
intp h = pGroup->followers.Head();
|
||||
intp hBest = pGroup->followers.InvalidIndex();
|
||||
int h = pGroup->followers.Head();
|
||||
int hBest = pGroup->followers.InvalidIndex();
|
||||
float distSqBest = FLT_MAX;
|
||||
|
||||
|
||||
while ( h != pGroup->followers.InvalidIndex() )
|
||||
{
|
||||
AI_Follower_t *p = &pGroup->followers[h];
|
||||
@@ -2690,7 +2724,7 @@ void CAI_FollowManager::ChangeFormation( AI_FollowManagerInfoHandle_t& hInfo, AI
|
||||
if ( pNewFormation == pGroup->pFormation )
|
||||
return;
|
||||
|
||||
intp h = pGroup->followers.Head();
|
||||
int h = pGroup->followers.Head();
|
||||
|
||||
while ( h != pGroup->followers.InvalidIndex() )
|
||||
{
|
||||
@@ -2737,7 +2771,7 @@ void CAI_FollowManager::RemoveFollower( AI_FollowManagerInfoHandle_t& hInfo )
|
||||
AI_FollowGroup_t *pGroup = hInfo.m_pGroup;
|
||||
AI_Follower_t* iterNode = &pGroup->followers[hInfo.m_hFollower];
|
||||
|
||||
intp slot = iterNode->slot;
|
||||
int slot = iterNode->slot;
|
||||
pGroup->slotUsage.Clear( slot );
|
||||
pGroup->followers.Remove( hInfo.m_hFollower );
|
||||
if ( pGroup->followers.Count() == 0 )
|
||||
@@ -2845,7 +2879,7 @@ AI_FollowGroup_t *CAI_FollowManager::FindFollowerGroup( CBaseEntity *pFollower )
|
||||
{
|
||||
for ( int i = 0; i < m_groups.Count(); i++ )
|
||||
{
|
||||
intp h = m_groups[i]->followers.Head();
|
||||
int h = m_groups[i]->followers.Head();
|
||||
while( h != m_groups[i]->followers.InvalidIndex() )
|
||||
{
|
||||
AI_Follower_t *p = &m_groups[i]->followers[h];
|
||||
|
||||
Reference in New Issue
Block a user