MCPcopy Create free account
hub / github.com/StrongPC123/Far-Cry-1-Source-Full / Update

Method Update

CryEntitySystem/EntitySystem.cpp:713–831  ·  view source on GitHub ↗

update the entity system /////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

711//update the entity system
712//////////////////////////////////////////////////////////////////////
713void CEntitySystem::Update()
714{
715 g_bProfilerEnabled = m_pISystem->GetIProfileSystem()->IsProfiling();
716
717 FUNCTION_PROFILER_FAST( m_pISystem,PROFILE_ENTITY,g_bProfilerEnabled );
718 //char strNumStatObjs[100];
719 //sprintf(strNumStatObjs," %d|Stat",(int)m_vStaticEntities.size() );
720
721 UpdateTimers();
722
723 {
724 m_vEntitiesInFrustrumPrevFrame.resize(0);
725 //m_vEntitiesInFrustrumPrevFrame.insert(m_vEntitiesInFrustrumPrevFrame.begin(), m_vEntitiesInFrustrum.begin(), m_vEntitiesInFrustrum.end());
726 m_vEntitiesInFrustrumPrevFrame = m_vEntitiesInFrustrum;
727 m_vEntitiesInFrustrum.resize(0);
728 }
729
730 CCamera Cam=m_pISystem->GetViewCamera();
731 Vec3d Min, Max;
732 EntityMap::iterator next;
733 int nRendererFrameID=0;
734 if(m_pISystem)
735 {
736 IRenderer *pRen=m_pISystem->GetIRenderer();
737 if(pRen)
738 nRendererFrameID=pRen->GetFrameID();
739// nRendererFrameID=pRen->GetFrameUpdateID();
740 }
741 bool bUpdateEntities=m_pUpdateEntities->GetIVal()?true:false;
742 bool bProfileEntities = m_pProfileEntities->GetIVal() >= 1;
743 bool bProfileEntitiesToLog = m_pProfileEntities->GetIVal() == 2;
744 bool bProfileEntitiesAll = m_pProfileEntities->GetIVal() == 3;
745 float fStartTime = 0;
746
747 SEntityUpdateContext ctx;
748 ctx.nFrameID = nRendererFrameID;
749 ctx.pCamera = &Cam;
750 ctx.fCurrTime = m_pISystem->GetITimer()->GetCurrTime();
751 ctx.fFrameTime = m_pISystem->GetITimer()->GetFrameTime();
752 ctx.bProfileToLog = bProfileEntitiesToLog;
753 ctx.numVisibleEntities = 0;
754 ctx.numUpdatedEntities = 0;
755 ctx.fMaxViewDist = Cam.GetZMax();
756 ctx.fMaxViewDistSquared = ctx.fMaxViewDist*ctx.fMaxViewDist;
757 ctx.vCameraPos = Cam.GetPos();
758
759 if (!bProfileEntities)
760 {
761 for (EntityMap::iterator it = m_mapEntities.begin(); it != m_mapEntities.end();it = next)
762 {
763 next = it; next++;
764 CEntity *ce= it->second;
765 UpdateEntity(ce,ctx);
766 }
767 }
768 else
769 {
770 if (bProfileEntitiesToLog)

Callers 1

UpdateEntityMethod · 0.45

Calls 15

IsProfilingMethod · 0.80
GetIProfileSystemMethod · 0.80
GetIValMethod · 0.80
GetITimerMethod · 0.80
GetZMaxMethod · 0.80
GetILogMethod · 0.80
GetAsyncCurTimeMethod · 0.80
DrawLabelExMethod · 0.80
Draw2dLabelMethod · 0.80
GetISystemFunction · 0.70
resizeMethod · 0.45
GetIRendererMethod · 0.45

Tested by

no test coverage detected