|
|
@ -53,7 +53,7 @@ struct AI_Follower_t |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
AIHANDLE hFollower; |
|
|
|
AIHANDLE hFollower; |
|
|
|
int slot; |
|
|
|
intp slot; |
|
|
|
AI_FollowNavInfo_t navInfo; |
|
|
|
AI_FollowNavInfo_t navInfo; |
|
|
|
AI_FollowGroup_t * pGroup; // backpointer for efficiency
|
|
|
|
AI_FollowGroup_t * pGroup; // backpointer for efficiency
|
|
|
|
}; |
|
|
|
}; |
|
|
@ -2561,7 +2561,7 @@ bool CAI_FollowManager::AddFollower( CBaseEntity *pTarget, CAI_BaseNPC *pFollowe |
|
|
|
|
|
|
|
|
|
|
|
AI_FollowSlot_t *pSlot = &pGroup->pFormation->pSlots[slot]; |
|
|
|
AI_FollowSlot_t *pSlot = &pGroup->pFormation->pSlots[slot]; |
|
|
|
|
|
|
|
|
|
|
|
int i = pGroup->followers.AddToTail( ); |
|
|
|
intp i = pGroup->followers.AddToTail( ); |
|
|
|
|
|
|
|
|
|
|
|
AI_Follower_t *iterNode = &pGroup->followers[i]; |
|
|
|
AI_Follower_t *iterNode = &pGroup->followers[i]; |
|
|
|
iterNode->hFollower = pFollower; |
|
|
|
iterNode->hFollower = pFollower; |
|
|
@ -2569,7 +2569,6 @@ bool CAI_FollowManager::AddFollower( CBaseEntity *pTarget, CAI_BaseNPC *pFollowe |
|
|
|
iterNode->pGroup = pGroup; |
|
|
|
iterNode->pGroup = pGroup; |
|
|
|
|
|
|
|
|
|
|
|
pGroup->slotUsage.Set( slot ); |
|
|
|
pGroup->slotUsage.Set( slot ); |
|
|
|
|
|
|
|
|
|
|
|
CalculateFieldsFromSlot( pSlot, &iterNode->navInfo ); |
|
|
|
CalculateFieldsFromSlot( pSlot, &iterNode->navInfo ); |
|
|
|
|
|
|
|
|
|
|
|
pHandle->m_hFollower = i; |
|
|
|
pHandle->m_hFollower = i; |
|
|
@ -2641,8 +2640,8 @@ bool CAI_FollowManager::RedistributeSlots( AI_FollowGroup_t *pGroup ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
AI_FollowSlot_t * pSlot = &pGroup->pFormation->pSlots[bestSlot]; |
|
|
|
AI_FollowSlot_t * pSlot = &pGroup->pFormation->pSlots[bestSlot]; |
|
|
|
Vector slotPos = originFollowed + pSlot->position; |
|
|
|
Vector slotPos = originFollowed + pSlot->position; |
|
|
|
int h = pGroup->followers.Head(); |
|
|
|
intp h = pGroup->followers.Head(); |
|
|
|
int hBest = pGroup->followers.InvalidIndex(); |
|
|
|
intp hBest = pGroup->followers.InvalidIndex(); |
|
|
|
float distSqBest = FLT_MAX; |
|
|
|
float distSqBest = FLT_MAX; |
|
|
|
|
|
|
|
|
|
|
|
while ( h != pGroup->followers.InvalidIndex() ) |
|
|
|
while ( h != pGroup->followers.InvalidIndex() ) |
|
|
@ -2691,7 +2690,7 @@ void CAI_FollowManager::ChangeFormation( AI_FollowManagerInfoHandle_t& hInfo, AI |
|
|
|
if ( pNewFormation == pGroup->pFormation ) |
|
|
|
if ( pNewFormation == pGroup->pFormation ) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
int h = pGroup->followers.Head(); |
|
|
|
intp h = pGroup->followers.Head(); |
|
|
|
|
|
|
|
|
|
|
|
while ( h != pGroup->followers.InvalidIndex() ) |
|
|
|
while ( h != pGroup->followers.InvalidIndex() ) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -2738,7 +2737,7 @@ void CAI_FollowManager::RemoveFollower( AI_FollowManagerInfoHandle_t& hInfo ) |
|
|
|
AI_FollowGroup_t *pGroup = hInfo.m_pGroup; |
|
|
|
AI_FollowGroup_t *pGroup = hInfo.m_pGroup; |
|
|
|
AI_Follower_t* iterNode = &pGroup->followers[hInfo.m_hFollower]; |
|
|
|
AI_Follower_t* iterNode = &pGroup->followers[hInfo.m_hFollower]; |
|
|
|
|
|
|
|
|
|
|
|
int slot = iterNode->slot; |
|
|
|
intp slot = iterNode->slot; |
|
|
|
pGroup->slotUsage.Clear( slot ); |
|
|
|
pGroup->slotUsage.Clear( slot ); |
|
|
|
pGroup->followers.Remove( hInfo.m_hFollower ); |
|
|
|
pGroup->followers.Remove( hInfo.m_hFollower ); |
|
|
|
if ( pGroup->followers.Count() == 0 ) |
|
|
|
if ( pGroup->followers.Count() == 0 ) |
|
|
|