Sources/CryGame C++/Solution1/CryGame/XArea.cpp
//////////////////////////////////////////////////////////////////////////
// check player's position for all the areas. Do onEnter, onLeave, updateFade

check player's position for all the areas. Do onEnter, onLeave, updateFade
check player ' s position for all the areas . Do onEnter onLeave updateFade
void	CXAreaMgr::UpdatePlayer(CXAreaUser& user)
{
	if (user.m_pGame->m_bIsLoadingLevelFromFile)
		return;
	FUNCTION_PROFILER( GetISystem(),PROFILE_GAME );
	unsigned int aIdx;
	user.m_vPos = user.m_pEntity->GetPos() + Vec3d(0,0,1);
	if (user.m_vPos == m_lastUpdatePos)
		return;
	m_lastUpdatePos = user.m_vPos;
	m_sCurStep++;
	for(unsigned int inIdx=0; inIdx<user.m_HostedAreasIdx.size(); inIdx++)
	{
		aIdx = user.m_HostedAreasIdx[inIdx];
		if( aIdx>=m_vpAreas.size() )
			return;
		m_vpAreas[aIdx]->m_stepID = m_sCurStep;
		if(!m_vpAreas[aIdx]->IsPointWithin(user.m_vPos))
		{
			ProceedExclusiveLeave( user, aIdx );
			user.m_HostedAreasIdx.erase( user.m_HostedAreasIdx.begin() + inIdx );
			inIdx--;
		}
	}
	for(aIdx=0; aIdx<m_vpAreas.size(); aIdx++)
		if( m_vpAreas[aIdx]->m_stepID != m_sCurStep )
			if(m_vpAreas[aIdx]->IsPointWithin(user.m_vPos))
			{
				if(ProceedExclusiveEnter( user, aIdx ))
					m_vpAreas[aIdx]->EnterArea(user);
				user.m_HostedAreasIdx.push_back( aIdx );
			}
	for(unsigned int inIdx=0; inIdx<user.m_HostedAreasIdx.size(); inIdx++)
	{
		aIdx = user.m_HostedAreasIdx[inIdx];
		if( aIdx>=m_vpAreas.size() )
			return;
		if( m_vpAreas[aIdx]->m_stepID == 0 )
			continue;
		if( !m_vpAreas[aIdx]->m_bIsActive )
			continue;
		ProceedExclusiveUpdate(user, aIdx);
	}
}
void CXAreaMgr :: UpdatePlayer ( CXAreaUser & user ) { if ( user . m_pGame -> m_bIsLoadingLevelFromFile ) return ; FUNCTION_PROFILER ( GetISystem ( ) , PROFILE_GAME ) ; unsigned int aIdx ; user . m_vPos = user . m_pEntity -> GetPos ( ) + Vec3d ( 0 , 0 , 1 ) ; if ( user . m_vPos == m_lastUpdatePos ) return ; m_lastUpdatePos = user . m_vPos ; m_sCurStep ++ ; for ( unsigned int inIdx = 0 ; inIdx < user . m_HostedAreasIdx . size ( ) ; inIdx ++ ) { aIdx = user . m_HostedAreasIdx [ inIdx ] ; if ( aIdx >= m_vpAreas . size ( ) ) return ; m_vpAreas [ aIdx ] -> m_stepID = m_sCurStep ; if ( ! m_vpAreas [ aIdx ] -> IsPointWithin ( user . m_vPos ) ) { ProceedExclusiveLeave ( user , aIdx ) ; user . m_HostedAreasIdx . erase ( user . m_HostedAreasIdx . begin ( ) + inIdx ) ; inIdx -- ; } } for ( aIdx = 0 ; aIdx < m_vpAreas . size ( ) ; aIdx ++ ) if ( m_vpAreas [ aIdx ] -> m_stepID != m_sCurStep ) if ( m_vpAreas [ aIdx ] -> IsPointWithin ( user . m_vPos ) ) { if ( ProceedExclusiveEnter ( user , aIdx ) ) m_vpAreas [ aIdx ] -> EnterArea ( user ) ; user . m_HostedAreasIdx . push_back ( aIdx ) ; } for ( unsigned int inIdx = 0 ; inIdx < user . m_HostedAreasIdx . size ( ) ; inIdx ++ ) { aIdx = user . m_HostedAreasIdx [ inIdx ] ; if ( aIdx >= m_vpAreas . size ( ) ) return ; if ( m_vpAreas [ aIdx ] -> m_stepID == 0 ) continue ; if ( ! m_vpAreas [ aIdx ] -> m_bIsActive ) continue ; ProceedExclusiveUpdate ( user , aIdx ) ; } }
check player's position for all the areas.
check player ' s position for all the areas .
// check player position - not foot
 // check all the areas player is in already
 //safecheck for editor
 // was inside, now is out - do OnLeaveArea
 // check all the rest areas (player is outside of them)
 // was outside, now inside - do enter area
 // update fade. For all hosted areas
 //safecheck for editor
 // this one already updated
 // this area is not active - overriden by same groupId area with higher id (exclusive areas)
